<html><head></head><body bgcolor="#FFFFFF"><div><br></div><div><br>On Mar 7, 2012, at 10:57 PM, Jim Kinney <<a href="mailto:jim.kinney@gmail.com">jim.kinney@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><p>I don't recall the source but I read the backticks are to concidered deprecated. Maybe in the bash 4 release notes?</p></div></blockquote><div>The $() form is the POSIX shell standard now IMSMR. All the kornish shells have supported it for a while now so it wouldn't surprise me to see it get deprecated</div><div><br></div><div>Also to nitpick on the original code:</div><div><br></div><div>* echoing the backticked output of hostname is kind of roundabout. Just run it</div><div><br></div><div>* the separate grep before awk could be replaced with just a single awk</div><div><br></div><div>awk '$0 !~ /swap/ {print $3}'</div><div><br></div><div>Or (for the whitespaceophobes :)</div><div><br></div><div>perl -lane '!/swap/&&print$F[2]'</div><div><br></div><br><blockquote type="cite"><div>
<div class="gmail_quote">On Mar 7, 2012 5:12 PM, "Michael Campbell" <<a href="mailto:michael.campbell@gmail.com">michael.campbell@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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" target="_blank">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>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><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" 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><br></div>
<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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Ale mailing list</span><br><span><a href="mailto:Ale@ale.org">Ale@ale.org</a></span><br><span><a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a></span><br><span>See JOBS, ANNOUNCE and SCHOOLS lists at</span><br><span><a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a></span><br></div></blockquote></body></html>