|
getting full path from relative path
given a relative path, how do i convert it into a full one. i.e. if i am in
/home/polypus
and i am given foo/bar then to get a full path i can just concatinate it with pwd, but what if i am given "../mama"
how do i programmatically convert:
/home/polypus and ../mama into /home/mama
in a way that will always work no matter what relative path is passed?
my first thought is to just cd to the directory and set a variable
cd $rev_path
full_path=`pwd`
cd $original_dir
it seems there must be a unix command which does this more elegantly?
thanks
|