Sebastien Willemijns
Sebastien Willemijns

Reputation: 15

Can not parse space inside a bash variable

I can not use spaces instead of "_" characters on this bash command:

text=-annotate\ +540+8\ \"July_9_2020_newspaper\"
magick -quality 100 out.png $text out1.png

I tried "\\ " => Error.

Any ideas ?

Thanks of your possible answer ;)

Upvotes: 1

Views: 104

Answers (1)

Léa Gris
Léa Gris

Reputation: 19675

Use an array to store multiple arguments to your command:

text=(-annotate +540+8 'July 9 2020 newspaper')
magick -quality 100 out.png "${text[@]}" out1.png

Upvotes: 1

Related Questions