木曜日, 12月 17, 2009

Converting a Relative Path to an Absolute Path in Bash

Converting a Relative Path to an Absolute Path in Bash

if [[ ! $d =~ /^\/.*/ ]]; then d=$PWD/$d; fi;

if the directory exists, then
echo "Absolute path: `cd $1; pwd`"
-- or --
readlink -f ../bar

0 件のコメント: