Subject: Re: RE : bash question, perhaps problem
From: Joe Buehler <[email-masked]>
To: [email-masked]
Date: Thu, 27 Jun 2002 11:18:44 -0400
Newsgroups: gmane.os.cygwin

bruno patin wrote:

> 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 may misremember, but I think that at least one older UNIX version
did not use to provide the name of the script in $0.  I believe it
was a version of System V that would actually give you something like
/dev/fd/7 for $0.

A Google search for "argv /dev/fd" in fact yielded the following from
what appears to be an IRIX man page for the exec() system call:

Set-user-ID, set-group-ID interpreter files and those with	attached
capabilities are handled in a special manner.  If execution of an
interpreter file will change either the user or group ID or the file has
attached capabilities, IRIX will open the interpreter file	for reading
(subject to the read permissions of the interpreter file and the user and
group ID of the new process).   A pathname	corresponding to the
interpreter file descriptor will be substituted for the pathname of the
interpreter file in the argument list passed to the intepreter.  This
pathname will be of the form /dev/fd/N where N is the number of the
interpreter file descriptor.

It may work on the systems you usually use, but it's not portable.

Joe Buehler

--
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/