For example, I want to execute the following within a shell script:
tar cvpzf /destination/backup.tgz /directory\ one /directory\ two
I wish to assign the list of paths (with whitespaces in them) to a variable at the top portion of a script, for easy maintenance.
How would one assign "/directory\ one /directory\ two" to a variable and then pass it on later, for example, to tar
, i.e.:
#!/bin/sh
backup_dirs=?????????
tar cvpzf /destination/backup.tgz $backup_dirs
without causing tar
to interpret /directory
and one
as separate entities, just how it would not do so when one executes it in the command line?
xargs
?