This is the mail archive of the 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 : [cygwin]bash question, perhaps problem

-----Message d'origine-----
De : Randall R Schulz [] 
Envoyé : mercredi 26 juin 2002 14:30
À : bruno patin; Cygwin
Objet : Re: [cygwin]bash question, perhaps problem


This is not a bug.

It has never been proper to examine $0 / argv[0] to determine anything 
about the current working directory in which a command was invoked.


If I look at the bash manual page (or sh page for this matter), I see
for the $0 expansion what is written under. What I understood (perhaps
badly) is that $0 (unless -c is used) give me the exact invocation of
the shell so If I take my example, suppose we are in the local directory
and I call the script toto, if called ./toto, $0 will be equal to ./toto
and if I invoked the script from another directory, say the build
directory by ../toto, then $0 will be equal to ../toto. What I saw is
that under the local directory, $0 is equal to ./toto but under the
build directory $0 is equal to /home/xxxxx/toto.

The problem we have is that we use a root value obtained by pwd and
append to it what is given to us by the $0 variable.

I prefer to explain a little more my "problem" (we worked a workaround
but It's for comprehension of the manual pages and what I wait from the
bash) as perhaps you don't understand what I meant (my english is poor I

Thanks for the help

------------man page extract---------------------
Expands to the name of the shell or shell script. This is set at shell
initialization. If Bash is invoked with a file of commands (see section
Shell Scripts), $0 is set to the name of that file. If Bash is started
with the `-c' option (see section Invoking Bash), then $0 is set to the
first argument after the string to be executed, if one is present.
Otherwise, it is set to the filename used to invoke Bash, as given by
argument zero.

Unsubscribe info:
Bug reporting:

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