Looks like I can do:

path = `dirname $path` # for directory
path = `basename $path` # similar to path=${path##/*/}

Is this the best option?

Rob Hudson wrote:
Given a variable with something like this in it:
/Volumes/Projects/Testing/Simple_Carbon_App.pkg

I need to extract the base path to get:
/Volumes/Projects/Testing

I found how to get the last part in an example, though I don't fully understand what's going on. Assuming "path" has the first volume path, calling this:

path=${path##/*/}

Will set path to: Simple_Carbon_App.pkg

I'm looking for more or less the opposite of that.

Any pointers to documentation would be good.  Working code is nice too.  :P

Thanks,
Rob
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to