On Wed, 2010-10-20 at 13:05 -0400, robert mckennon wrote:
> Feedback??? (Other than it was done on a winblows laptop)

It was a great presentation, and I really appreciate you stepping up
last minute! Sorry to nit pick on a few things, nothing personal, wasn't
trying to heckle. Just better to build good habits rather than bad.
Which is something I am still working on myself, thus pointing it out ;)

Here are some references and info on my nit picking from last night

Both $var and ${var} are valid for variable declaration.
However ${var} is a better habit for variable declaration.
http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion

Also most always it can't hurt to wrap that in double quotes.

"${var}"

That will preserve and respect spaces and special characters. Tends to
make scripts a bit safer and less error prone.
http://www.gnu.org/software/bash/manual/bashref.html#Double-Quotes
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_03.html
http://www.gentoo.org/doc/en/articles/bash-by-example-p2.xml

At one point this became a major issue in Gentoo. Every ebuild had to be
updated requiring certain variables to always be quoted, and in general
all variables in an ebuild. You can't even commit an ebuild via Gentoo's
repoman (used to commit ebuilds to portage) if variables are not quoted.
Its become that important.
http://marc.info/?l=gentoo-dev&m=119105436806707&w=2
http://dev.gentoo.org/~zmedico/portage/doc/man/repoman.1.html


The other point I nit picked on was subshells. While the following is
both valid for invoking commands, one does it in the same shell, the
other a subshell.

$(command) or `command`
http://www.gnu.org/software/bash/manual/bashref.html#Command-Substitution

Pretty sure the later is safer, as the first invokes the command in a
subshell. However I think they both invoke a subshell.

Subshells involve scope, and fork another process. Which can be a good
and bad thing, but they need to be understood and used properly. Or you
can have bugs in scripts that can be cumbersome to debug.
http://tldp.org/LDP/abs/html/subshells.html

In trying to confirm (which I still have not) if both the above syntax
fork off a child process in a subshell. I did come across the 100% save
way to execute a command in a bash script, without forking off another
process and ended up in a subshell. Using the built in command exec
http://tldp.org/LDP/abs/html/internal.html#EXECREF

> I have updated the wiki and the presentation is there as well.
> 
> http://www.jaxlug.org/index.php/2010/10/19

Thanks for adding it to the wiki!

-- 
William L. Thomson Jr.
Obsidian-Studios, Inc.
http://www.obsidian-studios.com


---------------------------------------------------------------------
Archive      http://marc.info/?l=jaxlug-list&r=1&w=2
RSS Feed     http://www.mail-archive.com/[email protected]/maillist.xml
Unsubscribe  [email protected]

Reply via email to