On 1/9/2012 3:30 AM, Dave Howorth wrote: > Jason Boxman wrote: >> I didn't want this solution to get lost in the void. It was provided to me >> by Ralf Weinedel. >> >>> Ubuntu uses dash for default 'sh' and the call must _export_ the >>> environment variables to be available inside the scripts. As a workaround I >>> changed the sub scriptrun in dirvish (around line 942) >> /bin/sh -c 'cd /var/backup/<vault>/20111228-3/tree; >> DIRVISH_SERVER=horus >> DIRVISH_CLIENT=horus DIRVISH_SRC= >> DIRVISH_DEST=/var/backup/<vault>/20111228-3/tree >> DIRVISH_IMAGE=<vault>:default:20111228-3 DIRVISH_STATUS=success ; >> /etc/dirvish/pre-server' > I'm not a shell expert so hopefully somebody else will chime in but > isn't the problem actually the semi-colon between the environment > variables and the command? Where does that come from?
Yes, I can confirm that Ubuntu and probably Debian use dash for their standard Bourne Shell: $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 2009-02-14 02:23 /bin/sh -> dash And yes, the problem is the semicolon. A standard feature of Bourne Shell is to specify environment variables in front of a command. When specified by themselves in a command, they are just a shell variable and need to be exported for child processes to see them, but when they are specified directly in front of a command, they are seen as environment variables and are only seen by the command itself. Here's a thorough test of the feature: $ sh -c 'TEST_INHERITANCE="It works" /bin/dash -c "echo \$TEST_INHERITANCE"' It works > > Cheers, Dave > > _______________________________________________ > Dirvish mailing list > [email protected] > http://www.dirvish.org/mailman/listinfo/dirvish > -- Loren M. Lang [email protected] http://www.alzatex.com/ Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc Fingerprint: 10A0 7AE2 DAF5 4780 888A 3FA4 DCEE BB39 7654 DE5B _______________________________________________ Dirvish mailing list [email protected] http://www.dirvish.org/mailman/listinfo/dirvish
