This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: /etc/profile.d/lilypond-profile.sh and basename


> 
> > 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]