simple (and stupid) shell scripting question
Christian Weisgerber
naddy at mips.inka.de
Mon Feb 15 14:48:32 UTC 2010
Nerius Landys <nlandys at gmail.com> wrote:
> #!/bin/sh
>
> DIRNAME="`dirname \"$0\"`"
> cd "$DIRNAME"
> SCRIPTDIR="`pwd`"
>
> What if I got rid of extra double quotes? Like this:
>
> DIRNAME=`dirname \"$0\"`
> cd "$DIRNAME"
> SCRIPTDIR=`pwd`
That is perfectly fine. Word-splitting and filename expansion are
not performed for variable assignments. Also immune is the expression
after "case", so this is always fine:
case $FOO in ...
--
Christian "naddy" Weisgerber naddy at mips.inka.de
More information about the freebsd-questions
mailing list