17 lines
271 B
Bash
Executable File
17 lines
271 B
Bash
Executable File
realpath ()
|
|
{
|
|
f=$@;
|
|
if [ -z "$f" ]; then
|
|
f=$(pwd)
|
|
fi
|
|
if [ -d "$f" ]; then
|
|
base="";
|
|
dir="$f";
|
|
else
|
|
base="/$(basename "$f")";
|
|
dir=$(dirname "$f");
|
|
fi;
|
|
dir=$(cd "$dir" && /bin/pwd -P);
|
|
echo "$dir$base"
|
|
}
|