From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17274 invoked by alias); 31 Oct 2012 19:40:59 -0000 Received: (qmail 17258 invoked by uid 22791); 31 Oct 2012 19:40:58 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED X-Spam-Check-By: sourceware.org Received: from ftp2.locations.org (HELO www.locationscout.com) (66.70.47.90) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Wed, 31 Oct 2012 19:40:53 +0000 Received: (qmail 61530 invoked by uid 1082); 31 Oct 2012 19:40:52 -0000 Date: Wed, 31 Oct 2012 19:40:00 -0000 From: David T-G To: CygWin Users' List Subject: Re: Command line arguments Message-ID: <20121031194051.GL67410@justpickone.org> References: <1351606847888-94081.post@n5.nabble.com> <20121031182143.M67652@ds.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+TmfHRtzwn46KAcg" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-10/txt/msg00486.txt.bz2 --+TmfHRtzwn46KAcg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1272 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 % 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 Content-length: 187 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFQkX7DGb7uCXufRwARApdFAKCoBbdSfEB+1xOnfXeoaSWFB+3RNwCgo3EV VfAvOxPwsmSyb1glE2bjxmc= =sMZj -----END PGP SIGNATURE----- --+TmfHRtzwn46KAcg--