Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Date: Thu, 10 Mar 2005 09:22:02 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: /etc/profile.d/lilypond-profile.sh and basename Message-ID: <20050310142202.GA16211@gully.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i On Thu, Mar 10, 2005 at 09:11:15AM -0500, Wheeler, Frederick W (Research) wrote: >In Cygwin, when I ssh to my machine, I get the following error from basename > >% ssh d1 >Last login: Thu Mar 10 08:54:40 2005 from caleb.crd.ge.com >basename: invalid option -- b >Try `basename --help' for more information. >-bash: [: too many arguments >% > >I've traced this into /etc/profile.d/lilypond-profile.sh. On line 25 we see > > basename "$0" > >which becomes > > basename "-bash" Hmm. This is due to running bash as a login shell. I don't see how this ever worked. >and gives the error. Perhaps this resulted from a change in basename >behavior in the recent coreutils update? I'm not sure. > >21 echo "Continuing anyway ..." >22 return 2 >23 fi 24 25 if [ -z "$ZSH_NAME" -a `basename "$0"` = "lilypond-profile" >] ; then >26 cat >/dev/stderr <27 28 Error: This script cannot be run in a subshell; it MUST be >sourced. 29 30 > >Changing line 25 to this > >25 if [ -z "$ZSH_NAME" -a `basename "/$0"` = "lilypond-profile" ] ; >then > >seems to work for me. Now > >basename "/$0" > >which becomes > >basename "/-bash" > >and basename prints "-bash" and everything seems to work OK. I'm not >sure what all the implications are though. For example, if $0 is "", >then basename "/$0" is basename "/" which produced "/". That might be >OK for the purposes of this script. I think that just adding a -- is a better fix: if [ -z "$ZSH_NAME" -a `basename -- "$0"` = "lilypond-profile" ] ; the cgf -- 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/