|
From: | Davy Durham |
Subject: | Re: Modifying $0? |
Date: | Thu, 08 Jul 2004 11:53:48 -0400 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 |
Paul Jarc wrote:
Okay, thanks for the explaination, I didn't consider using the source feature.Try this: #!/bin/sh if [ "$0" != what-you-want ]; then exec /bin/sh -c '. "$@"' what-you-want "$0" ${1+"$@"} fi shift ...
However, I'm not sure if this is a bug or what. I would expect the above to work with using the unconditional shift after the fi. But it's not working. The shift apparently needs to be conditional. If you actually try to run it (by putting this source into a file and invoking /bin/bash filename) I think you'll discover that sometimes the $0 in the exec command results in a $1 and sometimes does not.. strange
I'm going to try to work around it with a conditional shift, but if you know why this is happening please let me know.
Thanks again, Davy
[Prev in Thread] | Current Thread | [Next in Thread] |