Matthias Klose wrote:

> as a test case i createa bash script:
> 
> #!/bin/bash
> echo $0
> 
> and call it :
> $ (exec -a "name" ./a)
> the output is "./a"
> 
> 
> I fee the severity of this bug is normal though it may be a
> problem having a bug in such a core function of bash.
> 
> 
> Is it really a bug or is the feature obsolete ?

Neither.  Bash really does invoke the command with argv[0] set
to "name".  However, it's an executable shell script, so the kernel
actually turns the command into "/bin/bash ./a".  At that point,
normal shell script processing takes over, and $0 is set to the
name of the script.

The same thing happens if you omit the leading `#!/bin/bash', since
POSIX requires bash to behave the way the kernel does.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live Strong.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to