In shell scripts it is often necessary to convert a relative path name, i.e. "../usr/../lib/somefile" to
an absolute path name starting with a slash "/", i.e. "/lib/somefile". The following code fragment does exactly this:
D=`dirname "$relpath"`
B=`basename "$relpath"`
an absolute path name starting with a slash "/", i.e. "/lib/somefile". The following code fragment does exactly this:
D=`dirname "$relpath"`
B=`basename "$relpath"`
abspath="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
0 blogger-disqus:
Post a Comment