delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/26/17:00:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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>
Subject: RE : [cygwin]bash question, perhaps problem
Date: Wed, 26 Jun 2002 23:11:17 +0100
Message-ID: <000001c21d5e$661d9020$022b01c0@patin>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
In-Reply-To: <5.1.0.14.2.20020626062010.01b43240@pop3.cris.com>
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g5QL0Ou05261


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


Bruno,

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.


Randall,

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
fear).

Thanks for the help

------------man page extract---------------------
0
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:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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