kolonel
kolonel

Reputation: 1422

writing a bash script to loop over alphabet and insert arguments into string

I am trying to write a bash script to loop over the alphabet and insert the letters as an argument in a string. This is what I've tried:

for i in {A..Z}
do
        screen -d -m bash -c 'python ~/directory/script.py  $i '  //$i is supposed to evaluate to the letter
done

I am missing how to enter the argument in the string.

Upvotes: 0

Views: 388

Answers (1)

Andrey Mishchenko
Andrey Mishchenko

Reputation: 4206

Try replacing the single quotes around your 'python... line with double quotes.

Bash won't perform any expansion on strings enclosed in single quotes, which is why $i is not being parsed as you want.

Upvotes: 1

Related Questions