Incrontab not processing IF statement <p>First off I'm a Windows guy but getting tasked with Linux now. I am using <code>incrontab</code> to watch a directory on an Oracle Linux server. </p> <p>I am trying to modify it so that if it sees file <code>F078311</code> it will echo Test to the log file. Otherwise it will check to see if the file matches the 2nd format and executes that echo.</p> <p>It is running the 2nd IF and echo'ing the date to the log but is not echoing the Test to the log. Is there something wrong with my syntax? </p> <p>It is watching the <code>/export</code> directory. and <code>$1</code> would be <code>/export/F073811</code></p> <pre><code>incrontab -l /export IN_MODIFY,IN_CLOSE_WRITE,IN_MOVED_TO /usr/local/scripts/EXPrename.sh $@/$# </code></pre> <p>Shell script:</p> <pre><code>#!/bin/bash # This file is invoked using incron and will rename the file with the current date. # Set newdate as current date, YYYYMMDD-HHMMSS newdate="$(date +%Y%m%d-%H%M%S)" #Sets the filename as the filename_YYYYMMDD-HHMMSS filename="A$newdate.txt" joblog="/logs/joblog.log" [[ ( $1 =~ F073811$ ) ]] &amp;&amp; echo Test &gt;&gt; /logs/joblog.log #checks to file format to see if it looks like name_YYYYMMDD-HHMMSS. If it does not then it renames the file to that format. [[ ! ( $1 =~ A[0-9]{8}-[0-9]{6}\.txt$ ) ]] &amp;&amp; echo ---- `date` ------ &gt;&gt; "$joblog" </code></pre>