Hi, to those who suggested running the variable as: eval $SAVE Thank you - this got it working correctly. Cheers, John -----Original Message----- From: John Herlihy [mailto:johnh@e-dataservices.com.au] Sent: Monday, April 08, 2002 11:51 AM To: 'sunmanagers@sunmanagers.org' Subject: Need help running a cmd containing double-quotes via a variable Hi, I'm writing a ksh script that calls the Legato Networker save command in a variable, but I'm having trouble getting save to see the browse & retention variables. After a bit more investigation, I found that the same things happen for native unix commands such as tar: TAR="tar cvf /tmp/blah.tar \"/etc/hosts\" /var/adm/messages echo $TAR tar cvf /tmp/blah.tar "/etc/hosts" /var/adm/messages This returns these messages when run: tar: can't change directories to "/etc: No such file or directory a /var/adm/messages 1K So the first file, /etc/hosts, failed to backup with a similar problem to the save command. I've tried this in csh with the same errors. Here's the Legato SAVE variable I'm using: SAVE="save -s nw_svr -l full -i -q -b BACKUPPOOL -w \"5 weeks\" -y \"5 weeks\"" When I echo the variable, it is shown as: save -s nw_svr -l full -i -q -b BACKUPPOOL -w "5 weeks" -y "5 weeks" BUT when I run it, I get the error: save: invalid browse time: "5 At a glance, it appears that the backslash causes it to not read the rest of the variable when there is a space or a forward slash (ie /) seperating the contents of the double-quotes. (???) Does anyone know how to allow a command that contains double-quotes to be successfully called from a unix variable? Cheers, John _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Wed Apr 10 02:26:32 2002
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:39 EST