i'm stucked on this problem: i need a dynamic expression generation that has to be passed to ls command.
Here the code i tried:
op="ext"
fileName="MDL_test_"
fileExt=".csv"
if [[ $op == "noext" ]] ; then
searchExp="*$fileName*"
else
searchExp="*$fileName*$fileExt"
fi
ls "$("./files/"$searchExp)"
But when i execute the script this is what i get:
./ext_test.sh: line 15: ./files/MDL_test_30160410.csv.gz: Permission denied
ls: cannot access : No such file or directory
I think i'm doing something wrong, but i can't figure out it...
lsin scripts in the first place.echowould work as well, and have fewer complicating side effects.