Any sh shell programmers here? I need some quick help.

TangDN

Member
Mar 16, 2002
31
0
0
Given a file name, how can I find out its absolute path , (within a script that is) ?
I can grab the filename (thats easy), I just don't know what the command is to get its absolute path name.

Thanks for the help! Its my first post! haha..:D
 

PCHPlayer

Golden Member
Oct 9, 2001
1,053
0
0
file=foo/bar/xyz.txt

abspath=$cwd/$file

Don't know how to get rid of any relative paths (../.. stuff) within the absolute path.