I wrote a bash script. It basicaly gets three paths based on input parameters, and then gets the filename / filename in the path.
Sort of:
I provide:
AA=/home/user
He then uses the find command to get / home / user / dir 2 / images / dir / tellmeimage1fun.bin
Finally, I should get tellmeimage1fun.bin as output.
Script:
#!/bin/bash echo "arg0 n/k/d" AA=$1 CC=$3 PATH1="`find $AA/dir2/images/dir/ -name *image1*.bin`" PATH2="`find $AA/dir2/images/dir/ -name *bimage2*.bin`" PATH3="`find $AA/dir2/images/dir/ -name *cimage3*.bin`" if [ $CC = "n" ] ; then PATH=$PATH1 elif [ $CC = "k" ] ; then PATH=$PATH2 else PATH=$PATH3 fi
If I give full paths to ls and cut, they work. But I do not want to do this for all the commands in the script. If I delete the last line and repeat the PATH variable, it is completely perfect. Only after adding the last command I see a traffic jam.
Please help and let me know if I made an obvious mistake.
source share