www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/10/11/12:54:04

From: pavenis AT lanet DOT lv
Message-ID: <B0000104741@stargate.astr.lu.lv>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, Robert Hoehne <robert DOT hoehne AT gmx DOT net>,
djgpp-workers AT delorie DOT com
Date: Mon, 11 Oct 1999 18:44:32 +0300
MIME-Version: 1.0
Subject: Re: djconfig.sh for gdb-4.18
References: <B0000104726 AT stargate DOT astr DOT lu DOT lv>
In-reply-to: <Pine.SUN.3.91.991011171326.29794C-100000@is>
X-mailer: Pegasus Mail for Win32 (v3.12a)
Reply-To: djgpp-workers AT delorie DOT com

On 11 Oct 99, at 17:17, Eli Zaretskii wrote:

> 
> On Mon, 11 Oct 1999 pavenis AT lanet DOT lv wrote:
> 
> > +CONFIG_SHELL=`echo 'echo $0' | bash.exe -`
> > +case ${CONFIG_SHELL} in *.exe) ;;
> > +	*) CONFIG_SHELL=${CONFIG_SHELL}.exe;
> > +	   test -f ${CONFIG_SHELL} || exit 1
> > +	   ;;
> > +esac;
> > +		
> > +export CONFIG_SHELL		
> 
> This is a good idea, but there might be one caveat.  What does "echo $0" 
> print on your machine, exactly?  Specifically, does it use forward- or
> back-slashes?  If it uses back-slashes, Bash (or Make) could choke on 
> such a name when it is later used.
> 
> Whether the $0 is printed with backslashes or not depends on many 
> installation-dependent details.  So I suggest to pass $0 through a simple 
> Sed script that explicitly converts any \ into /, before assigning it to 
> CONFIG_SHELL.
> 
For me it prints name with forward slashes. Of course adding sed 
script to convert backslashes to forward slashes will not do any harm.
The main idea was to get rid of real /bin/sh

One comment. I found that if bash.exe is symlink (it's so on my 
machine) then 'echo $0' doesn't append extension .exe. So I forced
appending it if it's missing

Andris

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019