On Apr 7, 2010, at 4:01 AM, Noah Birnel <nbirnel_AT_gmail.com> wrote:
> I use backticks out of habit... and maybe ignorance. Can you explain
> your preference?
They are confusing:
echo $( echo $( echo $( echo str ) ) )
echo ` echo \` echo \\\` echo str \\\` \` `
echo $( echo \\ )
echo ` echo \\\ `
Backticks are also easily mistaken for single quotes and not readily
avaiable on intl. keyboards.
On Wed, April 7, 2010 1:25 am, "pancake" <pancake_AT_youterm.com> wrote:
> Is not the same... Backticks keeps newlines, but $() merges all lines
> into a single one. I'm not sure if this behaviour is affected by IFS
Not sure what you mean by this, or maybe it's shell dependant.
Both print the same:
dash -c 'echo "$(printf %s\\n str str2)"'
dash -c 'echo "`printf %s\\\n str str2`"'
And testing with literal newlines also works:
dash -c 'echo "$(printf %s\\n "new
line")"'
dash -c 'echo "`printf %s\\\n \"new
line\"`"'
Received on Wed Apr 07 2010 - 17:53:08 UTC
This archive was generated by hypermail 2.2.0 : Wed Apr 07 2010 - 18:00:04 UTC