help in bc


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help in bc
# 1  
Old 03-24-2004
help in bc

hi,

the following piece of code gives syntax error
vernum is got as a string value, and to convert it to floating point number, i am using

verno=$(echo "$vernum" + 0.0 | bc )

it gives the error as syntax error on line 1

can somebody explain?

thanks,
kavitha
# 2  
Old 03-24-2004
Not sure - what shell are you using, is the code you posted the first line of the script (or the only line)?

Try verno=`echo "$vernum" + 0.0 | bc`
# 3  
Old 04-03-2004
Re: help in bc

Quote:
Originally posted by kavitha
hi,

the following piece of code gives syntax error
vernum is got as a string value, and to convert it to floating point number, i am using

verno=$(echo "$vernum" + 0.0 | bc )

it gives the error as syntax error on line 1

can somebody explain?

thanks,
kavitha
verno=$(echo "$vernum+0.0"|bc)
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question