What is the ! mean in an cron scripts I have seen it in if statements, echo statements,
if [[ ! -a $file || ! -s $file ]]
tbasic <<!EOF! >> $TXTFILE
SDS_JOBS=`cat $data/start.dat | grep -v "!" | wc -l`
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
2 replies Latest Post - 2012-06-20T17:14:43Z by grumpy57
Pinned topic ! in if statements
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-06-20T17:14:43Z at 2012-06-20T17:14:43Z by grumpy57
haubi 060001CR9T37 PostsACCEPTED ANSWER
Re: ! in if statements2012-06-20T06:44:08Z in response to grumpy57There is no such thing like "cron scripts", they are pure (korn-)shell scripts, eventually started by cron.
For the syntax of korn-shell scripts, try "man ksh93".
> if [[ ! -a $file || ! -s $file ]]
Here it is the "not" operator, to be read as "if not exists $file or not exists-and-has-size-greater-than-zero $file".
> tbasic <<!EOF! >> $TXTFILE
Here it doesn't have any special meaning, it is part of the token "!EOF!" defined to mark the end of inlined text used as stdin for 'tbasic' command.
> SDS_JOBS=`cat $data/start.dat | grep -v "!" | wc -l`
Again no special meaning: SDS_JOBS contains the numer of lines in start.dat not containing "!".