Skip to main content
Tweeted twitter.com/super_user/status/1484224207475118086
Source Link
multipolygon
  • 940
  • 2
  • 7
  • 11

How do I use a Bash variable (string) containing quotes in a command?

Failing, simplified example:

FLAGS='--archive --exclude="foo bar.txt"'
rsync $FLAGS dir1 dir2

I need to include the quotes as if the command was like this:

rsync --archive --exclude="foo bar.txt" dir1 dir2