I prefer awk for this type of thing, because then you can output your answer any way you like using the printf statement.
On Wed, 27 Feb 2002 [EMAIL PROTECTED] wrote: > Date: Wed, 27 Feb 2002 02:30:45 +0530 > From: [EMAIL PROTECTED] > Reply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: bc > > HI all > I am trying to write a simple script that calculates 24.5% of an input value > I wrote the following which uses bc > > echo Enter a value > read number > > answer=(echo 0.245 \* $number)|bc > echo $answer > > but answer remains a null variable always > How do I carry out calculations using non integer values then ? > For integer values I could have used expr > ............................. > > > > > _______________________________________________ > Seawolf-list mailing list > [EMAIL PROTECTED] > https://listman.redhat.com/mailman/listinfo/seawolf-list > regards __o derek _`\<,_ (_)/ (_) ---------------------------------------------------------------- Derek Benson Infrastructure Management | Tel: +61 7 336 53959 Information Technology Services | Email: [EMAIL PROTECTED] The University of Queensland | http://www.its.uq.edu.au ================================================================ _______________________________________________ Seawolf-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/seawolf-list