Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a simple if then else statement

Status
Not open for further replies.

Ati2ude

Programmer
Dec 11, 2001
79
US
The follwoing code:
#Check if any files are in the error DB

lines=`hcidbdump -e | wc -l`;
echo $lines;
today=`date +%Y%m%d`;
echo $today;

if (( $lines != 8 ))
then
`hcidbdump -e -L >> $today.txt`;
fi


gives me the follwoing error:

db_check.ksh[13]: ^M: not found
db_check.ksh[15]: ^M: not found
db_check.ksh[21]: ^M: not found
db_check.ksh[23]: ^M: not found
db_check.ksh[24]: ^M: not found
10
db_check.ksh[25]: ^M: not found
db_check.ksh[26]: ^M: not found
20040908
db_check.ksh[27]: ^M: not found
db_check.ksh[28]: ^M: not found
db_check.ksh[28]: syntax error at line 29 : `if' unmatched

I am not sure where my syntax error is. I have tried several ways of doing this and I can't seem to make it work. TIA for any pointers.

Ati2ude
 
1.Make sure that you specify a shell interpreter with you script - that's the first line in the script.

2. I don't think you need ['] for your "dump" call

Code:
#!/bin/ksh
#Check if any files are in the error DB
    
    lines=`hcidbdump -e | wc -l`;
    echo $lines;
    today=`date +%Y%m%d`;
    echo $today;
 
if (( $lines != 8 ))
then
    hcidbdump -e -L >> $today.txt;
fi

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I just solved it. Thanks for the quick reply. I am writing the script using Komodo and uploading it via ftp. My ftp client was uploading as Binary not ascii.

Crackhead move on my part.

Ati2ude
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top