Feb 4, 2004 #1 cantubas Programmer Jan 8, 2004 45 FR how can i have the absolute name of a file i want to find a function that transforms ../name in /home/etc/name
how can i have the absolute name of a file i want to find a function that transforms ../name in /home/etc/name
Feb 4, 2004 #2 PHV MIS Nov 8, 2002 53,708 FR Try this: curdir=`pwd`; parent=`dirname "$curdir"` echo "$parent/name" Hope This Help PH. Upvote 0 Downvote
Try this: curdir=`pwd`; parent=`dirname "$curdir"` echo "$parent/name" Hope This Help PH.
Feb 4, 2004 Thread starter #3 cantubas Programmer Jan 8, 2004 45 FR thanks for your solution but it isn't OK. Upvote 0 Downvote
Feb 4, 2004 #4 PHV MIS Nov 8, 2002 53,708 FR In ksh you can try this: Code: f=../name realf=$(cd ..;pwd -P)/$(basename $f) echo "$f is $realf" Anyway: man cd;man pwd;man basename;man dirname Hope This Help PH. Upvote 0 Downvote
In ksh you can try this: Code: f=../name realf=$(cd ..;pwd -P)/$(basename $f) echo "$f is $realf" Anyway: man cd;man pwd;man basename;man dirname Hope This Help PH.
Feb 5, 2004 #5 aigles Technical User Sep 20, 2001 464 FR [tt] relFile=../name rep=`dirname $relFile` absFile=`cd $rep ; pwd`/`basename $relFile` echo "$relFile is $absFile" [/tt] the same with ksh [tt] relFile=../name $(cd $(dirname $relFile) ; pwd)/$(basename $relFile) echo "$relFile is $absFile" [/tt] Jean Pierre. Upvote 0 Downvote
[tt] relFile=../name rep=`dirname $relFile` absFile=`cd $rep ; pwd`/`basename $relFile` echo "$relFile is $absFile" [/tt] the same with ksh [tt] relFile=../name $(cd $(dirname $relFile) ; pwd)/$(basename $relFile) echo "$relFile is $absFile" [/tt] Jean Pierre.