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:
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
PATH
ls
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`"