sharad jain
sharad jain

Reputation: 153

Quotes issue in bash while executing python cmd line

i am running a python command per below in bash env, it runs fine :

python -c "from ami_management import cleanup; cleanup.main(['10', 'ctm'])"

But when i am passing variables :

amis_to_retain="10"
ami_prefix="ctm"
python -c "from ami_management import cleanup;cleanup.main([$amis_to_retain, $ami_prefix])"

then it fails. Somehow not able to figure out how to pass these variables with single quotes instead of double quotes.

Please suggest.

Upvotes: 0

Views: 34

Answers (1)

FelipeC
FelipeC

Reputation: 9488

You need to put quotes inside quotes.

python -c "from ami_management import cleanup;cleanup.main(['$amis_to_retain', '$ami_prefix'])"

Upvotes: 1

Related Questions