X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.2 required=5.0	tests=AWL,BAYES_00,KHOP_PGP_SIGNED
X-Spam-Check-By: sourceware.org
Date: Wed, 31 Oct 2012 15:40:51 -0400
From: David T-G <d12@justpickone.org>
To: "CygWin Users' List" <cygwin@cygwin.com>
Subject: Re: Command line arguments
Message-ID: <20121031194051.GL67410@justpickone.org>
References: <1351606847888-94081.post@n5.nabble.com> <20121031182143.M67652@ds.net> <k6rtcp$fo8$1@ger.gmane.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="+TmfHRtzwn46KAcg"
Content-Disposition: inline
In-Reply-To: <k6rtcp$fo8$1@ger.gmane.org>
User-Agent: Mutt/1.4i
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--+TmfHRtzwn46KAcg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Andrew, et al --

...and then Andrew DeFaria said...
%=20
% On 10/31/2012 11:23 AM, Brian Wilson wrote:
...
% >${1}, ${2}, etc.  Also, you may want to read up on the getopts command a=
s a
% >way to process command line arguments.
% Technically, the {}'s are not needed. You can access them with $1, $2,=20
...
% "/path/to/$1.save/dir" but not "/path/to/$1save/dir" you'd need the {}=20
% (i.e. "/path/to/${1}save/dir" because otherwise the shell would be=20
% looking for "1save" as an env variable name.

... except that environment variables cannot begin with numbers :-)

  davidtg@madi:~ > cat /tmp/numvars.sh
  bash --version
  save=3Dx
  echo $save
  1save=3Dy
  echo $1save
  echo ${1save}
  davidtg@madi:~ > bash -x /tmp/numvars.sh
  + bash --version
  GNU bash, version 2.05a.0(1)-release (i386-portbld-freebsd4.6)
  Copyright 2001 Free Software Foundation, Inc.
  + save=3Dx
  + echo x
  x
  + 1save=3Dy
  /tmp/numvars.sh: 1save=3Dy: command not found
  + echo save
  save
  /tmp/numvars.sh: ${1save}: bad substitution


% --=20
% Andrew DeFaria <http://defaria.com>
% Fear has its use but cowardice has none. - Mohandas Gandhi


HTH & Happy Hallowe'en

:-D
--=20
David T-G
See http://justpickone.org/davidtg/email/
See http://justpickone.org/davidtg/tofu.txt


--+TmfHRtzwn46KAcg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFQkX7DGb7uCXufRwARApdFAKCoBbdSfEB+1xOnfXeoaSWFB+3RNwCgo3EV
VfAvOxPwsmSyb1glE2bjxmc=
=sMZj
-----END PGP SIGNATURE-----

--+TmfHRtzwn46KAcg--
