[olug] sed issues inside of a script

John Hobbs john at velvetcache.org
Tue Nov 13 22:57:23 UTC 2007


Didn't know that either, always just used it for arrays.

As a related aside, is there a good document with best practices for
shell scripting?  My Google prowess failed me on that aspect. A book
would do as well.  I've just sorta picked this stuff up along the way
and I'd like to read over the "right" ways to do things.

- John

On 11/13/07, Obi-Wan <obiwan at jedi.com> wrote:
> > ${var} is the "standard" way to do variable
> > references of any kind in bash, deprecating the sh standard of $var and most
> > of the modifiers within {} are still expecting a normal scalar value.
>
> ${var} has been a standard syntax in sh for a very, very long time.  It
> certainly predates bash.  Omitting the braces is merely a shorthand
> that can be used unless a var is followed by a letter, digit, or
> underscore that is not to be interpreted as part of its name.
> Basically, the braces allow you to do variable substitution when the
> variable is immediately followed by more alphanumeric text.
>
> --
> Ben "Obi-Wan" Hollingsworth                             obiwan at jedi.com
>    The stuff of earth competes for the allegiance I owe only to the
>      Giver of all good things, so if I stand, let me stand on the
>        promise that You will pull me through.  -- Rich Mullins
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>



More information about the OLUG mailing list