![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| simple date problem | ali560045 | Shell Programming and Scripting | 4 | 01-22-2008 02:12 AM |
| a simple chat program | kelogs1347 | High Level Programming | 1 | 12-07-2006 07:59 AM |
| Simple Network Program Difficulties | Mistwolf | High Level Programming | 2 | 03-19-2002 06:34 AM |
| may be simple but i don't know -- Print current date from C program | ls1429 | High Level Programming | 6 | 02-19-2002 01:50 AM |
| QUESTION...simple program? | jj1814 | High Level Programming | 8 | 02-07-2002 01:04 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Simple program but problem-pls Help
Hi All,
I have problem in the following shell script (problem in 2and3 line i guess) #!/bin/sh set value1 = 90; set value2 = 70; if [ $value1 > $value2 ]; then echo "$value1 is normal" else echo "$value2 is abnormal" fi when executed output: $ value_test.sh (Enter) is abnormal Neither it's printing the $value1,nor it's displaying correct output.but no errors. It is not atall executing the loop properly and jumps to else directly. I guess the problem is with Set value command.. i guess it's wrong.... pls let me know the correct command. Thanks |
|
||||
|
Hi zaxxon and namishtiwari thanks for your quick turn over,
For namishtiwari If I edit code as per u say… im getting the following output: $ value_test.sh Is normal. Here it’s executing the loop successfully nut it’s not displaying $value1 value The out put should be like this right… $ value_test.sh 90 Is normal. Please see $value is missing. For zaxxon, If u edit code as per u say… Im getting the following error… $ value_test.sh value_test.sh: typeset: not found value_test.sh: typeset: not found is normal But here also it’s executing the loop. Please help me. Thanks |
|
|||||
|
Strange you dont have typeset... nvm, try this:
Code:
root@isau02:/data/tmp/testfeld> ./mach.sh
90 is normal
root@isau02:/data/tmp/testfeld> cat mach.sh
#!/bin/sh
value1=90
value2=70
if (( ${value1} > ${value2} )); then
echo "${value1} is normal"
else
echo "${value2} is abnormal"
fi
|
|
||||
|
Hi Zaxxon,
Still im not getting the desired output.. here is the code #!/bin/sh value1=90 value2=70 if (( ${value1} > ${value2})); then echo "${value1} is normal" else echo "${value2} is abnormal" fi and output: $ ./value_test.sh ./value_test.sh: 90: not found 70 is abnormal I DONT KNOW WATS WRONG... PLSSSSSSS HELP. THANKS |
|
||||
|
Quote:
namish@france => ./sample1 90 is normal No need to edit anything just copy the code. Thanks namish |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|