Simple bash function to convert relative paths to absolute pats
fun_abs
{ echo “`cd \`dirname $1\`; pwd`/`basename $1`” }
http://www.robertpeaslee.com/index.php/converting-a-relative-path-to-an-absolute-path-in-bash/
UPDATE: unfortuately the above only works for directories that exist - the perl hack will get around this
fun_abs
{FILE=`$PERL -e "use File::Spec::Functions qw[rel2abs];print rel2abs('$1');"`; echo "$FILE"; }
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment