X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-5.8 required=5.0	tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <20121101174144.M43908@ds.net>
References: <1351606847888-94081.post@n5.nabble.com>	<20121031182143.M67652@ds.net>	<k6rtcp$fo8$1@ger.gmane.org>	<20121031194051.GL67410@justpickone.org>	<20121101174144.M43908@ds.net>
Date: Thu, 1 Nov 2012 14:01:00 -0400
Message-ID: <CA+sc5mkySs10Tg7iCJrFifRGjPe==rQ=kEk+oCAJPO_NiiTcqw@mail.gmail.com>
Subject: Re: Command line arguments
From: Earnie Boyd <earnie@users.sourceforge.net>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
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

On Thu, Nov 1, 2012 at 1:54 PM, Brian Wilson wrote:
>> > % >${1}, ${2}, etc.  Also, you may want to read up on the getopts
>> > command as a % >way to process command line arguments. % Technically,
>> > the {}'s are not needed. You can access them with $1, $2, ... %
>> > "/path/to/$1.save/dir" but not "/path/to/$1save/dir" you'd need the
>> > {} % (i.e. "/path/to/${1}save/dir" because otherwise the shell would
>> > be % looking for "1save" as an env variable name.
>>
>> ... except that environment variables cannot begin with numbers :-)
>>
>
> True, but that won't keep the system from trying to interpret the string as
> a variable and erroring out on something a novice might easily write.
>

Actually, I started to state this as well then I tried it.  To my
surprise ``echo $1save'' echoed the contents of $1 followed by the
string save.

> I got in the habbit of always using the "{}" (even if they aren't absolutely
> necessary) to avoid such issues on general principal.

A generally good habit to learn.  It helps to prevent the WTF moments.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

