This is the mail archive of the
mailing list for the Cygwin project.
RE : [cygwin]bash question, perhaps problem
- From: "bruno patin" <bruno dot patin at wanadoo dot fr>
- To: "'Randall R Schulz'" <rrschulz at cris dot com>
- Cc: "Cygwin" <cygwin at cygwin dot com>
- Date: Wed, 26 Jun 2002 23:11:17 +0100
- Subject: RE : [cygwin]bash question, perhaps problem
De : Randall R Schulz [mailto:firstname.lastname@example.org]
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 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
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html