[ale] scripts, file I/O, and loss of hair

The Don Lachlan ale-at-ale.org at unpopularminds.org
Thu May 12 19:16:20 EDT 2011


On Thu, May 12, 2011 at 06:38:51PM -0400, James Sumners wrote:
> $(echo "This is much nicer than backquotes.")
> [1] -- http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html#sect_03_04_04

If I'm nesting shell commands (*shudder*), I use $(). Otherwise, I've found
backticks are more readable and better understood.

My main point, however, was that "foo=$(cat bar)" is A Bad Idea <tm> because
cat'ing a file in command substitution runs the risk of overflowing your
buffer. "foo=`<bar`" or "foo=$(<bar)" are both safer, but I think the first
is easier to read and better understood.

-L

> 
> On Thu, May 12, 2011 at 5:14 PM, The Don Lachlan
> <ale-at-ale.org at unpopularminds.org> wrote:
> > Also,
> >
> >  directions=$(cat $2)
> >
> > should be replaced by
> >
> >  directions=`<${1}`


More information about the Ale mailing list