delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/18/18:16:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: dumb escaping question when using Cygwin + NT commands
Date: Wed, 18 Sep 2002 18:15:41 -0400
Message-ID: <7BFCE5F1EF28D64198522688F5449D5AC1E21A@xchangeserver2.storigen.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Scott Prive" <Scott DOT Prive AT storigen DOT com>
To: "Cygwin" <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g8IMGPD20193

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019