home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   TUXPOWER      Advocacy for the Linux operating system      1,237 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 257 of 1,237   
   Damon A. Getsman to All   
   That damn quoting issue in shell scripti   
   25 Jun 15 11:48:20   
   
       Mm'kay, so I'm using GNU bash, version 4.1.2(1)-release   
   (x86_64-redhat-linux-gnu), just to make sure that we're covering all of the   
   bases here.   
       Basically what I would like to do is be able to get to the bottom of this   
   quoting bug that has been making it completely impossible for me to utilize   
   certain functionality, such as some of the ssh command lines that I have been   
   trying to utilize from within the shell scripties here.   
       All that I would like to do is specify a hardcoded (or better yet,   
   variable-set) file to use as the ssh identity when I'm connecting to another   
   server.  As you guys have seen, I've previously been attempting to do that with   
   stuff like the following snippet:   
      
       if [ $VERBOSE -gt 0 ] ; then   
           RSYNC_OPTS="-vHrltDPi -e 'ssh -i /home/scriptuser/.ssh/id_rsa' \   
               $USER@$SOURCE:$STATIC_ASSETS $STATIC_ASSETS"   
      
           echo Rsyncing $STATIC_ASSETS with options: $RSYNC_OPTS   
           $RSYNC $RSYNC_OPTS   
           echo Done   
       fi   
      
       Whenever I attempt to do so, I receive the error that I've mentioned before   
   like follows:   
      
   ./sync_static_to_dev.sh    
   Rsyncing /server/assets with options: -vHrltDPi -e 'ssh -i   
   /home/scriptuser/.ssh/id_rsa' scriptuser@10.183.1.251:/server/assets   
   /server/assets   
   Unexpected remote arg: scriptuser@10.183.1.251:/server/assets   
   rsync error: syntax or usage error (code 1) at main.c(1201) [sender=3.0.6]   
   Done   
      
       I've also tried this with escaped double quotes around the ssh command line   
   and a few other random incantations, some typed with a chicken-bone pentagram   
   laid out around my feet on the full moon, with a little veganaise (in lieu of   
   actual sacrificial blood) pasted upon the important power lines.  Nothing seems   
   to be working, and I'm really not having any success getting this to work.   
       Anyhoo I thought I'd post this with the shell information and stuff just in   
   case that makes enough of a difference so that something might present itself a   
   little more available to work with sans voodoo here.   
       Anybody have any pointers?  I'm currently trying another couple of things;   
   putting all of the ssh options into another variable, for instance.  I'm pretty   
   sure I could make this horrific script work by throwing the ssh command itself   
   into a second script that the first one calls, but gross, seriously?  There's   
   got to be a better way on this shit.   
       Also, anything on how to get around shell escaping issues when building   
   command lines that might take a person from a relative neophyte status like   
   myself to a significantly higher level of foolishness would be greatly   
   appreciated.  Sorry for the pseudo-double post here, I just wanted to make sure   
   that I wasn't missing anything without that previous info.   
       TIA   
      
       -D   
      
       PS I totally forgot to add this bit, but the error makes me think that   
   something after rsync's '-e' option isn't being handled properly, like the   
   single-quoted text is being broken apart into tokens/words at inappropriate   
   boundaries.  It seems to me that 'unexpected remote arg' bit in the rsync error   
   wouldn't be focusing on the appropriately constructed login:server:path string   
   if things were broken apart correctly on these boundaries as _I_ seem to   
   understand them.  Any elucidation on this that I can use to improve my   
   understanding would be greatly, _greatly_ appreciated.   
   --- SBBSecho 2.27-OpenBSD   
    * Origin: Tinfoil.synchro.net - now at FTN (1:340/200) (1:340/200)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca