What's wrong with this condition


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What's wrong with this condition
# 8  
Old 03-11-2012
If it didn't then it shouldn't have worked from test file...!
# 9  
Old 03-11-2012
How were you calling the script? You should call it as ./script bash ./script and not as sh ./script. Is there a shebang on the first line of the script?

Last edited by Scrutinizer; 03-11-2012 at 02:08 PM..
This User Gave Thanks to Scrutinizer For This Post:
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 return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

2. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

3. 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

4. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

5. Shell Programming and Scripting

syntax of if condition in ksh is wrong

The syntax of 'if' conditionals in bash and ksh seems different. I am trying to check for a particular version using 'if' in ksh. This very simple syntax gives syntax error. I have tried many variants, but no go. Please correct the syntax. Later I will expand it to 'if' and 'else'. #!/bin/ksh... (8 Replies)
Discussion started by: nivedhitha
8 Replies

6. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 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. UNIX for Dummies Questions & Answers

What am I doing wrong?

I really just mess around in UNIX, for the most part, when I want to get something done. I can usually piece things together by searching for brief how-to's on Google, but the syntax errors in my following .sh file are really confusing me. I've got lots of programming experience in other places, so... (7 Replies)
Discussion started by: demonpants
7 Replies

9. Shell Programming and Scripting

Anything wrong with this

Does anyone see anything wrong with this. #getInfraFiles() #{ # cd Infra/$DAY # rm * # /usr/bin/ftp -i -n $LINE << cmd # user "$USER" "$PASSWD" # cd $INFRAPATH # binary # mget * # bye #} besides that its commented out (4 Replies)
Discussion started by: rcunn87
4 Replies

10. UNIX for Dummies Questions & Answers

Please tell me what do I do wrong here!

#!/usr/bin/csh # DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` mailx -s "$H-Myfile" email@email.com</home/mydir/myfile Thanks! (4 Replies)
Discussion started by: bobo
4 Replies
Login or Register to Ask a Question