Mail Archives: cygwin/2005/03/10/09:26:57
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 <<EOF
>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/
- Raw text -