puppetlabs/beaker — pull request #60 by adrienthebo (2013-11-07 20:50:29+00:00)
Title: Quote ruby interpolated data in bash commands

Bash conditionals demonstrate strange behaviors when not given an arg.
Given the following:

if [ -f ]; then
echo "how did I get here?"
fi
#=> how did I get here?

Wrapping ruby interpolated variables in quotes act as expected:

if [ -f '' ]; then echo
"how did I get here?"
else
echo "the empty string is not a file"
fi
#=> the empty string is not a file

The moral of the story is that bash exists to make everybody sad.