Shell script
Gordon Keegan
lgk011 at dma.isg.mot.com
Wed Jun 14 04:14:51 EDT 2000
or missing something small...
var='ping -c 5 bacon | grep 64'
assigns the the string 'ping -c 5 bacon | grep 64'. What you want is
var=`ping -c 5 bacon | grep 64`
(note the back single-quote ` instead of the forward single-quote ')
That should do the trick.
Gordon
> Okay know I don't feel so bad. For some reason this is not working. My
> command is ping -c 5 bacon | grep 64 - when I assign it var='ping cmd'
> then echo $var - it echos the command, not the answer I'm expecting 5. I
> haven't had to due much shell sccripting so I could be missing something
> big.
>
> As always all help appreciated.
>
> Thanks,
> Anthony
>
> On Tue, 13 Jun 2000, Anthony J. Gabrielson wrote:
>
> > Hello,
> > I have what I hope to be an easy question. How do I make the
> > output of a command, it will be a number, assign to a variable. I'm using
> > bash - I have been reading through several books on this and I'm starting
> > to get frusterated.
> >
> > Thanks,
> > Anthony
> >
> > -
> > Subcription/unsubscription/info requests: send e-mail with
> > "subscribe", "unsubscribe", or "info" on the first line of the
> > message body to discuss-request at blu.org (Subject line is ignored).
> >
>
> -
> Subcription/unsubscription/info requests: send e-mail with
> "subscribe", "unsubscribe", or "info" on the first line of the
> message body to discuss-request at blu.org (Subject line is ignored).
>
--
Gordon Keegan, M10-10 Phone: (508) 261-4696
Motorola ING Fax: (508) 261-5757
20 Cabot Boulevard
Mansfield, MA 02048 email: lgk011 at dma.isg.mot.com
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list