[colug-432] Argument Quoting in BASH

Jeff Frontz jeff.frontz at gmail.com
Wed Apr 15 11:01:29 EDT 2015


On Wed, Apr 15, 2015 at 10:22 AM, <jep200404 at columbus.rr.com> wrote:

> There is no difference in this case
> with the bash shell that I'm using.
>

The "with the ... shell that I'm using" is the best reason for (and why I
concur with):


 I usually enclose my regular expression for grep
> and commands for sed with single quotes, not double quotes.
>


Long ago, it got burned into my brain that "sed programs passed via the
command line must be surrounded by single-quotes" so (even though it's not
strictly true) I just do it and don't think about it (unless, of course, I
need to do some variable substitution with the shell to modify the sed
command).

With all of the extensions/hacks and varieties of shells and environment
modifications and command-line editors (and not remembering which obscure
meta-characters are active in each possible scenario and not knowing what
the next person maintaining your script might change in the search/sed
string), being more conservative about (or should I say "liberal with" ?)
quoting will save you mental cycles of trying to figure out whether or not
to actually quote and/or why the command didn't do what you expected
without quotes.

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20150415/7802f01c/attachment.html 


More information about the colug-432 mailing list