X-Recipient: archive-cygwin AT delorie DOT 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 To: "CygWin Users' List" Subject: Re: Command line arguments Message-ID: <20121031194051.GL67410@justpickone.org> References: <1351606847888-94081 DOT post AT n5 DOT nabble DOT com> <20121031182143 DOT M67652 AT ds DOT 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 AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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 AT madi:~ > cat /tmp/numvars.sh bash --version save=3Dx echo $save 1save=3Dy echo $1save echo ${1save} davidtg AT 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFQkX7DGb7uCXufRwARApdFAKCoBbdSfEB+1xOnfXeoaSWFB+3RNwCgo3EV VfAvOxPwsmSyb1glE2bjxmc= =sMZj -----END PGP SIGNATURE----- --+TmfHRtzwn46KAcg--