- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] BASH command return value
- From: ken@xxxxxxxxxx
- Date: Sat Aug 5 01:41:52 2000
- Reply-to: ken@xxxxxxxxxx
- User-agent: IMP/PHP3 Imap webMail Program 2.0.11
> When I change the PS1 sring to,
>
> PS1='($?)`whoami`@\h:\w =>'
>
> The return value for $? is immediately displayed in the next prompt.
>
> (0)subb3@myhost:~ =>
> (0)subb3@myhost:~ => lssdfh
> (258)subb3@myhost:~ =>
> (0)subb3@myhost:~ =>
> (0)subb3@myhost:~ => ls
> <file listing>
> (0)subb3@myhost:~ => ls o
> ls: o: No such file or directory
> (1)subb3@myhost:~ =>
>
> In BASH, why does the "\u" and "whoami" make a big difference for the $?
> value in
> PS1 string? The BASH version is 2.04.
Because you are running a whoami command inside the prompt? To convince yourself
that the next number displayed is the result of the command inside the `s,
substitute exit 123 for whoami.
------------------------------------------------------
This mail sent via NLC WebMail: http://www.nlc.net.au/