else: endif not found in csh
I'm getting a 'else: endif not found' error when running the below script to check the number of files in 2 folders is the same. The syntax looks right to me but the output I get is:
Code:
Checking no of files in source and destination. Code:
#!/bin/csh |
This looks wrong:
Quote:
Quote:
|
Thanks, I don't know how I didn't spot the two sets. I've also got a working csh script with no space before the parenthesis.
I've changed the start of the file before the if because, as you can see from the output in the first post, the noFilesLocal and noFilesRemote variables are always going to be different as they include file paths. I've been trying to split them on the space character and use that to compare them but I'm having some difficulty with the syntax. Code:
#!/bin/csh Quote:
I found that cd'ing to the directory first instead of passing in the directory gives the number of items only without the file path being appended: Code:
cd / |
that awk will not work also:
Code:
set var = `echo $noFilesLocal | awk ' split ($0, ..... '` # use " " inside awk, not ' ' |
All times are GMT -5. The time now is 03:54 PM. |