Re: echo $BASH_SOURCE in Test_Bash_2.sh

"Stephen Grant Brown" <[email protected]>
Newsgroups gmane.comp.gnu.mingw.msys
Message-ID <6C21B6E7936546C2903612CFB1F75C1D@Elshadai>
Hi Keith

Thanks for your reply.

In a msydvlpr shell I get

---------------------------------------------------
GNUCash@ELSHADAI ~
$ uname -orv
uname: invalid option -- o
Try `uname --help' for more information.

GNUCash@ELSHADAI ~
$ sh --version
GNU bash, version 2.04.0(1)-release (i686-pc-msys)
Copyright 1999 Free Software Foundation, Inc.

GNUCash@ELSHADAI ~
$

--------------------------------------------------------------

Obviously I need to update.

This is the enviroment I get when compiling GNUCash from their packaging 
svn.

I know that it creates other bin subdir when installing the compiler tools.

I will need to work out how to add these bin subdir to .bashrc so I can test 
why gnucash compiles
very unreliably on this machine.

It has been suggested to me that I could have a race condition in rm

Is there a whereis command under msys/mingw?

Thanks in advance for your help

Stephen Grant Brown

----- Original Message ----- 
From: "Keith Marshall" <[email protected]>
To: <[email protected]>
Sent: Wednesday, March 18, 2009 9:53 PM
Subject: Re: [Mingw-msys] echo $BASH_SOURCE in Test_Bash_2.sh


> Hi Stephen,
>
> Please consider migrating to MinGW-users; I'd like to deprecate this
> list.  Thanks.
>
> On Wednesday 18 March 2009 00:55:16 Stephen Grant Brown wrote:
>> In Test_Bash_2.sh
>>
>> I have
>>
>> echo $LINENO
>> echo $BASH_SOURCE
>> echo $LINENO
>> pwd
>> echo $LINENO
>>
>> The following is the output of a msys shell
>>
>> $ Test_Bash_2.sh
>> 1
>>
>> 3
>> /src
>> 5
>
> And you expected to see `./Test_Bash_2.sh', rather than that blank
> line between `1' and `3'?  I can't reproduce this; I see:
>
>  $ uname -orv
>  1.0.11(0.46/3/2) 2009-01-29 00:39 Msys
>
>  $ sh --version
>  GNU bash, version 3.1.0(1)-release (i686-pc-msys)
>  Copyright (C) 2005 Free Software Foundation, Inc.
>
>  $ cat > foo.sh <<\EOF
>  > #!/bin/sh
>  > echo $LINENO
>  > echo $BASH_SOURCE
>  > echo $LINENO
>  > pwd
>  > echo $LINENO
>  > EOF
>
>  $ foo.sh
>  2
>  ./foo.sh
>  4
>  /home/keith
>  6
>
> (Note that I added a shebang, which accounts for the line number
> differences, but the result is similar without it).
>
>> I am using msys on a Windows XP machine
>
> What versions of MSYS, and bash?
>
>> Under cygwin on a Windows ME machine I see the Test_Bash_2.sh
>> filename printed.
>
> FWIW, I see the same on my Ubuntu-8.04-LTS box, but I also see it in
> the latest MSYS-1.0.11 snapshot, on Win2K, with bash-3.1.0(1).
>
>> Why am I not seeing it on this machine?
>
> Perhaps you are using an older version of bash?  In any case, I'd
> caution against using $BASH_VERSION in this fashion; see:
>
>  $ man bash
>    :
>  BASH_SOURCE
>      An array variable whose members are the source filenames
>      corresponding to the elements in the FUNCNAME array variable.
>    :
>  FUNCNAME
>      An array variable containing the names of all shell functions
>      currently in the execution call stack.  The element with index
>      0 is the name of any currently‐executing shell function.  The
>      bottom‐most element is "main".  This variable exists only when
>      a shell function is executing.  ...
>
> Note that $BASH_SOURCE is an array variable, and it is related to the
> $FUNCNAME array variable, which is empty (undefined) when not within
> the scope of execution of a shell function.  Thus, the behaviour you
> see, (i.e. $BASH_SOURCE is empty), actually seems to me to be more
> consistent with the documentation.
>
> If you want the file name for the current script, get it from $0.
>
> -- 
>
> Regards,
> Keith.
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Mingw-msys mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-msys
> 


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mingw-msys mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.