I'm trying to add a script to check conditions before executing a command in my .cshrc
file. This checker script returns 0 if the conditions are insufficient, and 1 otherwise. (I realize this is backwards of convention, but I thought it would be easier for if statements.)
Here is what I've tried, replacing the command with echo "ok"
:
./checker.sh && echo "ok"
Echoes "ok" even though checker.sh
returns 0.
test ./checker.sh && echo "ok"
Echoes "ok" even though checker.sh
returns 0, but also suppresses error messages in checker.sh
.
if ( ./checker.sh ) then echo "ok" endif
Throws an if-statement syntax error.
I want to turn this into an alias, hence the one-line constraint, e.g.
alias doAction './checker.sh && echo "ok"'
How does one accomplish this with (t)csh
without directly calling the command in the checker script?
Thanks!