This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dumb escaping question when using Cygwin + NT commands


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]