delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/10/11:32:04

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
From: ericblake AT comcast DOT net (Eric Blake)
To: "Wheeler, Frederick W (Research)" <wheeler AT crd DOT ge DOT com>, cygwin AT cygwin DOT com
Subject: Re: /etc/profile.d/lilypond-profile.sh and basename
Date: Thu, 10 Mar 2005 16:31:34 +0000
Message-Id: <031020051631.421.42307666000436E6000001A522007358340A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

> 
> > I think that just adding a -- is a better fix:
> >
> > if [ -z "$ZSH_NAME" -a `basename -- "$0"` = "lilypond-profile" ] ; the
> >
> > cgf
> 
> This also fixes the problem for me and is clearly the better solution.  basename 
> --help does not mention this option.

Actually, all coreutils (and most other well-behaved programs) that take options and arguments also take -- as a delimiter to allow all subsequent parameters to be treated as arguments and not options - it is the behavior standardized by POSIX.  See `info Coreutils' under the chapter 2 Common options.  A good rule of thumb in scripting is that if you are expanding an arbitrary variable and don't know whether it will start with a leading -, then you should be using a -- delimiter.

--
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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