[ale] Stupid Bash Question

Brandon Colbert colbert.brandon at gmail.com
Wed Mar 7 11:36:08 EST 2012


Got it thanks.

I replaced the single quote with double on the sides, and changed test to
-ge. I we are good.

Thanks for pushing me in the right direction.

for i in $(seq 1 1); do ssh 127.0.0.$i "echo `hostname`; if [ `free -m |
grep -i swap | awk '{print $3}'` -ge 1000 ]; then sudo echo reclaim; else
echo hey; fi"; done

On Wed, Mar 7, 2012 at 11:25 AM, Benjie <benjie.godfrey at gmail.com> wrote:

> It looks like you missed placing a single quote after the 'echo `hostname`
> command.  That would prevent awk from interpreting its print command.
>
> On Wed, Mar 7, 2012 at 11:07 AM, Brandon Colbert <
> colbert.brandon at gmail.com> wrote:
>
>> I am trying figure out what the heck is wrong with awk here.
>>
>> 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
>>
>> The command works, but I get an error about awk: Any suggestions?
>>
>> deblapatl01
>> awk: cmd. line:1: {print
>> awk: cmd. line:1:       ^ unexpected newline or end of string
>> hey
>>
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>
>
> --
> "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
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20120307/b1bc34fa/attachment-0001.html 


More information about the Ale mailing list