One advantage of $() over `` is that you get matching opposing pairs of parens and nested commands are a bit easier to parse.<div><br></div><div>echo $(foo bar $(baz blah) and then bleh)</div><div><br></div><div>as opposed to </div>
<div><br></div><div>echo `foo bar `baz blah` and then bleh` </div><div><br></div><div><br></div><div>For me another win is that I generally run shells inside emacs buffers so I can make use of the paren-matching feature from within emacs to help out.</div>
<div><br><br><div class="gmail_quote">On Wed, Mar 7, 2012 at 11:25 AM, Benjie <span dir="ltr"><<a href="mailto:benjie.godfrey@gmail.com">benjie.godfrey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It looks like you missed placing a single quote after the 'echo `hostname` command. That would prevent awk from interpreting its print command.<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Wed, Mar 7, 2012 at 11:07 AM, Brandon Colbert <span dir="ltr"><<a href="mailto:colbert.brandon@gmail.com" target="_blank">colbert.brandon@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"><div>I am trying figure out what the heck is wrong with awk here.</div><div>
<br></div><div>for i in $(seq 1 1); do ssh 127.0.0.$i 'echo `hostname`; if [ `free -m | grep -i swap | awk '{print $3}'` > 1000 ]; then sudo echo reclaim; else echo hey; fi'; done</div>
<div><br></div><div>The command works, but I get an error about awk: Any suggestions?</div><div><br></div><div><div>deblapatl01</div><div>awk: cmd. line:1: {print</div><div>awk: cmd. line:1: ^ unexpected newline or end of string</div>
<div>hey</div></div><div><br></div>
<br></div></div>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>"The most important thing to remember about drunks is that drunks are far more intelligent than non-drunks. They spend a lot of time talking in pubs, unlike workaholics who concentrate on their careers and ambitions, who never develop their higher spiritual values, who never explore the insides of their head like a drunk does." -- Shane McGowan<br>
</font><br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div>