|
|
Question : Interpreting a filepath in script and string manipulation
|
|
I have a script that starts with #!/bin/csh -f and I'm trying to take a path passed in, do a whole bunch of stuff, move up one level and print that path. Instead of showing the path with the '..' in the middle, I'd like to interpret it so that it appears as the path I want to print. For example:
set DISTDIR = $2/$SCMBRANCH cp "afile.zip" "$DISTDIR/.." echo "Copied to $DISTDIR/.."
Instead of that last echo showing the /.., I'd like it to just display the actual directory it copied it too. Can't figure it out? Is there a function to interpret the path into a fully qualified path? Or maybe I just need to parse off the last directory (but I don't know how to do that either)?
Thanks!
|
Answer : Interpreting a filepath in script and string manipulation
|
|
echo "Archived contents to `pwd`/afile.zip"
|
|
|
|
|