Getting “command not found” error in bash script

前端 未结 6 1200
鱼传尺愫
鱼传尺愫 2020-12-02 00:27

I have written a bash script that gets three paths based on input parameters and then then gets the imagename/filename in the path.

Something like:
I provide:

6条回答
  •  情话喂你
    2020-12-02 01:06

    You are using the PATH that is special and used to locate the commands and that is why ls can't be resolved. Use any name other than PATH

    if [ $CC = "n" ] ; then  
        MY_PATH=$PATH1  
    elif [ $CC = "k" ] ; then  
        MY_PATH=$PATH2  
    else  
        MY_PATH=$PATH3  
    fi 
    
    export MY_PATH
    
    IMG="`ls $MY_PATH | cut -d "/" -f6`"
    

提交回复
热议问题