Results 1 to 2 of 2
Code:
#!/usr/bin/expect -f
set EXCLUDE "--exclude 'home/dave/fun'"
spawn tar -czf /home/backup/dave.tgz -C / home/dave/ $EXCLUDE
I will get this error
Code:
spawn tar -czf /home/backup/dave.tgz -C / home/dave/ --exclude 'home/dave/fun'
...
- 01-28-2012 #1Just Joined!
- Join Date
- May 2009
- Posts
- 4
expect problem with set
I will get this errorCode:#!/usr/bin/expect -f set EXCLUDE "--exclude 'home/dave/fun'" spawn tar -czf /home/backup/dave.tgz -C / home/dave/ $EXCLUDE
How do I fix the problem with "set EXCLUDE" Do I need to escape -- some how?Code:spawn tar -czf /home/backup/dave.tgz -C / home/dave/ --exclude 'home/dave/fun' tar: unrecognized option '--exclude 'home/dave/fun' Try `tar --help' or `tar --usage' for more information.
if I do this in shell it works with no problem at all...Code:tar -czf /home/backup/dave.tgz -C / home/dave/ --exclude 'home/dave/fun'
- 01-29-2012 #2Just Joined!
- Join Date
- Nov 2010
- Posts
- 9
It looks to me like the --exclude and 'home/dave/fun' have been combined into a single argument to tar (tar expects the shell to separate arguments into individual strings, it doesn't parse the command line itself).
Try:
set EXCLUDE='home/dave/fun'
spawn tar -czf /home/backup/dave.tgz -C / home/dave/ --exclude $EXCLUDE


Reply With Quote