Please see part of a shell script below.
#Move folder to HOT folder echo " moving $PRE_OCR_DIR/$BATCHNAME to $HOT_FOLDER_DIR\n" #chmod -R 777 $PRE_OCR_DIR/$BATCHNAME mv $PRE_OCR_DIR/$BATCHNAME $HOT_FOLDER_DIR
I wish to write an if statement around the move that if that if $BATCHNAME ends in an odd number
$BATCHNAME
mv $PRE_OCRDIR/$BATCHNAME $HOT_FOLDER_DIR2
grateful for any help
if [[ 13579 == *"${BATCHNAME:$((${#BATCHNAME}-1)):1}"* ]] then #Move folder to HOT folder echo " moving $PRE_OCR_DIR/$BATCHNAME to $HOT_FOLDER_DIR\n" #chmod -R 777 $PRE_OCR_DIR/$BATCHNAME mv $PRE_OCR_DIR/$BATCHNAME $HOT_FOLDER_DIR fi
case $BATCHNAME in (*[13579]) mv ... ;; esac
bash,ksh,zsh also take
if [[ $BATCHNAME == *[13579] ]] then mv ... fi
Try also
if ((${BATCHNAME: -1}%2)) then... fi