syntax of if condition in ksh is wrong


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting syntax of if condition in ksh is wrong
# 8  
Old 08-26-2011
Thank you jlliagre and fpmurphy!
# 9  
Old 08-26-2011
Quote:
Originally Posted by fpmurphy
This works just as well and is a cleaner syntax
Code:
if (( version > 2.1 ))
..

Indeed, I was fooled by:
Code:
$ echo $KSH_VERSION
Version JM 93t+ 2010-03-05
$ version=2.2
$ if (( version > 2.1 ))
ksh93:  version > 2.1 : arithmetic syntax error

but just found it was due to a locale issue.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If condition giving syntax error. Need help.

Hi, I have an if condition on executing it is giving syntax error as below: -------------------------------------------------------------------------------------- line 61: syntax error in conditional expression ./play_test.sh: line 61: syntax error near `]' ./play_test.sh: line 61: ` if... (2 Replies)
Discussion started by: ramki067
2 Replies

2. UNIX for Dummies Questions & Answers

[Solved] ksh script - can't figure out what's wrong

Hi! (I guess this could of gone into the scripting forum, but Unix for Dummies seemed more appropriate. Please note that I am not in school, so Homework doesn't seem appropriate either. You guys can let me know if you think otherwise.) I am following an exercise in a book on ksh scripting which... (2 Replies)
Discussion started by: sudon't
2 Replies

3. Shell Programming and Scripting

What's wrong with this condition

if && ] then + : test: ] missing Thanks in advance :) (8 Replies)
Discussion started by: ezee
8 Replies

4. Shell Programming and Scripting

What's wrong with this condition

if Please indicate the problem with this code Thanks in advance :) (4 Replies)
Discussion started by: ezee
4 Replies

5. Shell Programming and Scripting

Help with ksh using OR condition

I'm having an issue using OR condition, the script seems to work just fine but gives an error message while executing as can be seen in BOLD RED below: Code: #cat test.sh #!/bin/ksh set -x if || > /dev/null 2>&1;then echo "Fibre adapter found" else echo "No fibre... (10 Replies)
Discussion started by: mbak
10 Replies

6. Shell Programming and Scripting

Help with IF Condition Syntax

Hi. I expect the following unix script command to return 8: ls -ltr dropez* | grep -c dropez I can't seem to find the correct syntax (borne shell), can anyone help be to write an IF condition something like this: IF (ls -ltr dropez* | grep -c dropez) = 8 THEN ...do stuff ELSE ...do... (4 Replies)
Discussion started by: buechler66
4 Replies

7. Shell Programming and Scripting

Whats wrong with this IF condition?

I have four variables, dumpdata, defndata, compare1 and compare2 I want an IF statement condition which returns true when either dumpdata=defndata or (dumpdata<=compare1 and dumpdata>=compare2). But this is not working for me.. if (4 Replies)
Discussion started by: indianjassi
4 Replies

8. Shell Programming and Scripting

Whats wrong with the syntax

Whats wrong with below logic or syntax???? (4 Replies)
Discussion started by: dsravan
4 Replies

9. Shell Programming and Scripting

. $startApache wrong syntax?

Hi All, why doesn't this code start apache at boot? Cheers. coolboarderguy... startApache=/usr/local/apache2/bin/apachectl start if ; then . $startApache fi (5 Replies)
Discussion started by: coolboarderguy
5 Replies

10. Shell Programming and Scripting

What was wrong ??? ksh

I wrote this code and did not know what did I do wrong ?? ## get the first line of this file AFIRST=$(head -1 rss-cs-3423a-20051211-060001.dat) #CJKA|2005-12-10 08.01.30.000000|1111111111|ECI|1112221111|1113331111|1114441111 <--- this is a answer ## Third line of stat file BTHREE=$(cat... (11 Replies)
Discussion started by: sabercats
11 Replies
Login or Register to Ask a Question