dumb escaping question when using Cygwin + NT commands

Scott Prive Scott.Prive@storigen.com
Wed Sep 18 15:40:00 GMT 2002


Hello,

I get this odd problem when calling NT commands from Cygwin. I am single-quoting the data, but the way I'm doing things (probably wrong...) does not like passing $1 function arguments to NT commands. If I hardcode the arguments internally, everything works.

The two example functions below are intended to behave identical.

#!/bin sh

mount_drive () {
   # Syntax: net 'use' '*' '\\redhat\foo' 'foo' '/user:foo'
   net 'use' 'F:' '\\redhat\foo' 'foo' '/user:foo'

   echo "The command returned $?"
   return $?;
}

mount_drive2 () {
   net '$1' '$2' '$3' '$4' '$5'
   echo "we saw in mount_drive2: '$1' '$2' '$3' '$4' '$5' "

   echo "The command returned $?"
   return $?;
}

# 
mount_drive
mount_drive2 'use' 'G:' '\\redhat\foo' 'foo' '/user:foo'
############# END SCRIPT


the output I get from mount_drive2 is standard "usage info", indicating I passed arguments incorrectly. However the debug echo *looks* correct.

Someone please point out my mistake, else I'm doomed to some ugly hackish workarounds ;-)

Thanks,

Scott

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list