How to write a cycle pro all files *.py except a.py?
for i in *.py && !(a.py); do
python3 $i
done
How to write a cycle pro all files *.py except a.py?
for i in *.py && !(a.py); do
python3 $i
done
With extended globs (shopt extglob set in Bash), !(a).py should match all filenames ending in .py, except for a.py:
$ shopt -s extglob
$ ls
a.py bar.py foo.py foo.txt
$ echo !(a).py
bar.py foo.py
But you could also just exclude that one file manually with a test, this wouldn't need any Bash-specific features:
for f in ./*.py; do
[ "$f" = a.py ] && continue
python "$f"
done