if: Expression syntax error in csh if statement
I've got a simple csh script that checks for the exit code of grep and echos the result:
Code:
#!/bin/csh Can anyone see what's wrong with it? |
Quote:
Code:
(df -k | /usr/xpg4/bin/grep -q /mnt/Backup == 0) Try this: Code:
#!/bin/csh |
Thanks, that solved that problem, unfortunately I'm coming across more strangeness.
The script says the mount failed but it's definitely listed in the df output: Code:
{root}: CheckMount.sh Code:
{root}: `df -k | /usr/xpg4/bin/grep -q /mnt/Backup` |
if you run
Code:
# `something` Code:
# `echo ls` |
How about just running the command and then testing the error code:
<command> if [ $? ] then <do something>; else <do something else>; endif |
Also, outside the syntax issue - why use df to check if something is mounted rather than just using mount?
The below will also work for csh: Code:
#!/bin/sh |
So far I've got:
Code:
#!/bin/csh Quote:
dayid, your code gives: Ambiguous output redirect I think it's the '2>&1' but changing this to the more csh friendly >& gives 'Missing name for redirect'? |
So you tried it w/o the data redirects also, right?
Code:
#!/bin/csh |
Quote:
Code:
#!/bin/csh |
All times are GMT -5. The time now is 08:53 PM. |