Googling found me this: http://www.phwinfo.com/forum/comp-unix-shell/392108-strip-path-get-filename.html which appears to be a response to one Dave Kirby.
basename does the trick, doesn't it? John 2010/1/11 Craig Citro <craigci...@gmail.com>: >> Having thought about it more, there could be a problem with my original >> approach. IF someone typed >> >> $ export MAKE=/my/favorite/make -j 200 >> $ make >> >> then my approach, and your suggestion for sage-env would work. >> > > You've also got trouble if they do > > $ export MAKE='/my/favorite/path with spaces/make -j 100' > > because that awk command just prints the first space-delimited token. > The only way I can think of to get around that would be to use a > regexp to take everything after the last / to find the path, then use > something like the awk command above to get the command name, and > append them back together. Is there a more clever way to do it? > > Also, presumably you could even have a situation like this: > > $ export FOO='/my/favorite/path to make/"make with a space"' > > That one's even less fun ... > > -cc > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > >
-- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org