![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 08:16 AM |
| syntax error | ibroxy | Shell Programming and Scripting | 5 | 01-03-2008 05:03 AM |
| I got error like...syntax error on line 1, teletype | koti_rama | UNIX for Advanced & Expert Users | 2 | 07-07-2007 04:35 PM |
| awk syntax error | yongho | Shell Programming and Scripting | 4 | 06-20-2005 07:03 AM |
| Syntax error.. | livetaurean19 | Shell Programming and Scripting | 0 | 06-14-2005 01:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
multiplication shows syntax error
my shell script is simple arithmetic process.my addtion,substract and divide all can be worked only except multiplication.please help me.the shell is following:
Code:
#!/usr/bin/sh echo "enter a number1:" read number1 echo "enter an operator:" read operator echo "enter a number2:" read number2 echo "result is:" result='expr $number1 $operator $number2' echo $result Last edited by Yogesh Sawant; 04-08-2008 at 01:57 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
What does * represent for the shell?
That should help you see what is going wrong... |
|
#3
|
|||
|
|||
|
Since you have posted very lately a few, that give me the feeling its close to homework if not...
I will just show you that modifying just a little your script I end with: Code:
ra:/home/vbe $ calcul enter a number1: 34 enter an operator: * enter a number2: 2 result is: 68 ra:/home/vbe $ Last edited by Yogesh Sawant; 04-08-2008 at 01:58 AM. Reason: added code tags |
|
#4
|
|||
|
|||
|
I get the strings concatenated if i use below:
temp=23 expr $temp*60 it gives me '23*60' as output instead of the actual multiplied value. Could you please help me out? |
|
#5
|
|||
|
|||
|
I got it now. Thanks anyways..
it must be expr[space]$variable[space]\*[space]60 thanks |
|||
| Google The UNIX and Linux Forums |