in reply to Sourcing shell scripts

This does not work if $0 contains whitespace ;) But that's easily remedied by either renaming your script or by adding proper quoting for whatever shell you're using.

Replies are listed 'Best First'.
Re^2: Sourcing shell scripts
by tuxz0r (Pilgrim) on Oct 19, 2007 at 17:40 UTC
    The only place I could think of that one might encounter spaces in $0 would be on a Windows platform. Yes, technically spaces are allowed file names in *nix but I rarely ever see it. And, the environment we're using this in is a controlled, known business environment so we're not trying to make these completely portable or cross-platform. I guess if there are some Unix folks that like putting spaces in their file/script names, then quoting could resolve the issue. Good points, though, Corion.