I'm trying to schedule my shell script but when it triggered to process on a scheduled task, there is this error prompt. but when no files are to be process it just displays the echo command.
here is my code:
if [ "$(ls -A $path)" ]
then
for file_name in "$path"/*; do
filebasename=$(basename "$file_name")
prefix=${filebasename:0:4};
if [ "$prefix" == "abcd" ] ; then
mv "$file_name" "$out"
fi
done
else echo "No files available at $path"
fi
and this is the error:
SH:prefix=${filebasename:0:4}:0403-011 The specified substitution is not valid for this command
${var:n:m}expansion is not available in /bin/sh. You'd need to specify ksh or bash for that. Same with the==operator.