Reputation: 751
I'm trying to launch multiple python scripts with bash, for the purpose of later processing the data these scripts generate.
MYPIES=("/path/to/a.py" "path/to/b.py" "path/to/c.py" ... "path/to/xyz.py" )
for i in "${MYPIES[@]}"
do
python ${MYPIES[i]} &
done
However this snippet causes the following error:
syntax error: operand expected (error token is "/path/to/a.py")
Upvotes: 1
Views: 42
Reputation: 3710
the variable i
holds the filenames, it is not index to an entry in MYPIES.
MYPIES=("/path/to/a.py" "path/to/b.py" "path/to/c.py" ... "path/to/xyz.py" )
for i in "${MYPIES[@]}"
do
python "$i" &
done
Upvotes: 1