[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modifying $0?
From: |
Paul Jarc |
Subject: |
Re: Modifying $0? |
Date: |
Thu, 08 Jul 2004 14:24:20 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Davy Durham <pubaddr@davyandbeth.com> wrote:
> So, I put the extra parameter outside the -c '...' parameter which
> seems to work fine too. (Foresee any problems with that?)
That should work the same as my version. But I'd use $BASH instead of
$SHELL, and there's no need to attach the shift with "||". (You could
separate them with ";" if you want them on one line.)
And actually, we can simplify it a bit - there's no need to pass all
the arguments to source/".". This version would work with any sh, not
just bash, and would work with the -e option, if you're into that:
#!/bin/sh
[ "$0" = what-i-want ] || exec /bin/sh -c '. "$1"' what-i-want "$0" ${1+"$@"}
shift
paul