This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi! >>>>> Jens-Ulrik Petersen writes: Gord> Here's the magic you want: Gord> #!/home/petersen/mount/solaris/bin/guile -s Gord> exec /home/petersen/mount/solaris/bin/guile -s "$0" ${1+"$@"} Gord> exit 1 Gord> !# juhp> I have a couple of questions about that. Since they are juhp> probably obvious to most people here, if you have time you may juhp> prefer to answer them privately. I'll answer publically so that if somebody knows better than me, they can correct me. juhp> Why ${1+"$@"}? Is "$@" not good enough? On some systems, "$@" expands to the empty string when $1 is unset. So, if you call your script with no arguments, and with a plain "$@", the exec line would be interpreted as: exec /home/petersen/mount/solaris/bin/guile -s "/path/to/my/script" "" which would be no good (an extra null argument would be passed). juhp> Why is the "exit 1" necessary? It's so that if the exec fails, the rest of the script doesn't get interpreted by /bin/sh, leading to mass confusion. -- Gordon Matzigkeit <gord@fig.org> //\ I'm a FIG (http://www.fig.org/) Lovers of freedom, unite! \// I use GNU (http://www.gnu.org/) Copyright (C) 1998 FIG.org; the creator offers you this gift and wants it to remain free. See http://www.fig.org/freedom.html for details. This work may be copied, modified and distributed under the GNU General Public License (GPL). See http://www.gnu.org/copyleft/gpl.html.