Shell Quoting. Was: Shell tips and tricks
Ben Scott
dragonhawk at gmail.com
Mon Oct 8 14:26:25 EDT 2007
On 10/8/07, Tom Buskey <tom at buskey.name> wrote:
> Make sure you start your script with #!/bin/bash or #!/bin/ksh. $(...) does
> not exist in Bourne shell so you shouldn't expect #!/bin/sh to have it.
Didn't we already have this discussion? :-)
> On a similar note, why would you use [[...]] instead of [...] ?
According to Ye Olde FM, "word splitting and pathname expansion are
not performed on the words between the [[ and ]]", but I've never used
that particular construct in practice. Perhaps as an alternative to
quoting individual arguments?
I've used $(( ... )) for arithmetic before. It's faster than
calling the external expr(1) program, generally doesn't need quoting,
nests nicely, and looks better.
-- Ben
More information about the gnhlug-discuss
mailing list