IF statement error in tcsh
Posted
by
kaustav datta
on Stack Overflow
See other posts from Stack Overflow
or by kaustav datta
Published on 2012-11-14T10:35:47Z
Indexed on
2012/11/14
10:59 UTC
Read the original article
Hit count: 348
Having trouble executing an IF statement through tcsh. This works FINE for me -
#!/bin/bash
if echo `cal|tail -6|sed -e 's/^.\{3\}//' -e 's/.\{3\}$//' |tr -s '[:blank:]' '\n' | head -11|tail -10|tr -s '\n' ' '`|grep -w `date "+%e"`
then
echo "present"
else
echo "absent"
fi
This is the PROBLEM -
#!/bin/tcsh
if echo `cal|tail -6|sed -e 's/^.\{3\}//' -e 's/.\{3\}$//' |tr -s '[:blank:]' '\n' | head -11|tail -10|tr -s '\n' ' '`|grep -w `date "+%e"`
then
echo "present"
else
echo "absent"
endif
Getting this error-
if: Expression Syntax.
then: Command not found.
I really need this to run using "tcsh"
© Stack Overflow or respective owner