12 lines
261 B
Bash
12 lines
261 B
Bash
|
#!/bin/bash
|
||
|
function abs-path {
|
||
|
local target="$1"
|
||
|
if [ "$target" == "." ]; then
|
||
|
echo "$(pwd)"
|
||
|
elif [ "$target" == ".." ]; then
|
||
|
echo "$(dirname "$(pwd)")"
|
||
|
else
|
||
|
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
||
|
fi
|
||
|
}
|