correct way to write is:
c=`echo $a + $b | bc`
and _not_
c='echo $a + $b | bc'

not the difference between "`" and "'"


hth,
- Janees

--- "hashir n.a" <[EMAIL PROTECTED]> wrote:
> 
> Hai Evry1
> 
> SUB: Shell Scripting
> SHELL : bash
> 
> i wantd to add two nos and store their result in a variable.i did this.
> 
> a=5 b=6
> c='echo $a + $b | bc'
> echo $c
> 
> i am tryin to pipe the output of 'echo $a + $b' to bc. So that bc would get 
> 5 + 6 as i/p. and c shld get the value 11.
> 
> But , the o/p : echo $a + $b | bc. Its seems tht the variable c has stored 
> the command as a string!!!!whyz is this happng???isn't is possible to assign 
> the o/p to a variable????
> 
> Please help.
> 
> hashir
> 
> 
> 
> 
> -------------------------------------------------------------------------
> Do What U Must not Must U what.   *******
> -------------------------------------------------------------------------
> 
> _________________________________________________________________
> Easiest Money Transfer to India. Send Money To 6000 Indian Towns. 
> http://go.msnserver.com/IN/48198.asp Easiest Way To Send Money Home!
> 
> 
> _______________________________________________
> Mailinglist mailing list
> [email protected]
> http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
> 



                
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

Reply via email to