0

I wrote the below small shell script. However when i run it am getting the error ctrlM_chk_input_file.sh[5]: find: not found but I thought the backtics will make the find statement to be run as a unix command. Am I missing something?

PATH="/main/nedcor/flexcube"

cd $PATH
'pwd'
DIR_LIST=`find . -name "INPUT"`

for INPUT_PATH in $DIR_LIST

do
    RESULT=`ls -A $INPUT_PATH | grep -v BKUP`
    echo $RESULT 
    if [ -z $RESULT ] ;
    then 
        echo "No Files found"
        exit 0
    else
        echo file $RESULT found
        exit 1
    fi
done
1
  • 2
    As Eric already explained, the issue is that you're changing the system variable, PATH. This is why you should always avoid using UPPER CASE variable names in shell scripting.
    – terdon
    Commented Apr 29, 2015 at 16:37

1 Answer 1

6

PATH is a "magic" variable that tells the shell where to find executables. You changed that to just your directory, which does not have a find executable.

If you use a different name it should work

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .