通过 tcsh 执行 IF 语句时遇到问题。这对我来说很好 -
#!/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
这就是问题 -
#!/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
收到此错误-
if: Expression Syntax.
then: Command not found.
我真的需要使用“tcsh”来运行它