Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Feb 2010 14:48:28 +0000 (UTC)
From:      naddy@mips.inka.de (Christian Weisgerber)
To:        freebsd-questions@freebsd.org
Subject:   Re: simple (and stupid) shell scripting question
Message-ID:  <hlbmrs$1fc8$1@lorvorc.mips.inka.de>
References:  <560f92641002142207w7eade79fr6a4f40ae5b92f4b9@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Nerius Landys <nlandys@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@mips.inka.de




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?hlbmrs$1fc8$1>