[ale] Stupid Bash Question
Michael Campbell
michael.campbell at gmail.com
Wed Mar 7 16:15:37 EST 2012
One advantage of $() over `` is that you get matching opposing pairs of
parens and nested commands are a bit easier to parse.
echo $(foo bar $(baz blah) and then bleh)
as opposed to
echo `foo bar `baz blah` and then bleh`
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.
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/6db4f7b5/attachment.html
More information about the Ale
mailing list