I'm trying to loop over files with having different searching conditions based on the folder which I used with a case statement. basically it's:
#!/bin/bash
case folder in
"Testordner")
search_filename=*_0_*.txt
;;
"Ordner2")
search_filename=*_65_*fg*.txt
;;
*)
;;
esac
for files in $search_filename; do
echo $files
done
I had expected to get a list of the files fitting to the search criterium in the last echo. Instead I get the search criterium itself.
For testing I tried F="*.txt";for files in $F;do echo $files;done
directly in the bash (which worked and I got a list of files) and in the same script (which got me the output *.txt
Already tried different variable expansion stuff (e.g. $(..) ((..)) ${..}
, which all did not work.)
Why is that and how can I get around?
Would be great to find help. Best wishes Caro
using Ubuntu 22.04LTS, KDE/plasma desktop; bash v5.1.16(1). Terminal: konsole v21.12.3
python -i script_name.py parameter
or inside the interpreter usingpython
(and then executing text)