Shell Quoting. Was: Shell tips and tricks

Tom Buskey tom at buskey.name
Mon Oct 8 14:07:00 EDT 2007


On 10/8/07, Ben Scott <dragonhawk at gmail.com> wrote:

>   Another tip about shell quoting: Prefer $( ... )  to `...`.  Both
> run a command and capture the output as an argument, but $( ... )
> nests automatically, while `...` can create nested quoting nightmares.


Some editors will hightlight/find the (...) where they won't find `...`
pairs as easily.

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.

On a similar note, why would you use [[...]] instead of [...] ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20071008/aff55ad3/attachment.html 


More information about the gnhlug-discuss mailing list