[techtalk] BASH command return value
Dan Nguyen
nguyend7 at cse.msu.edu
Fri Aug 4 13:06:00 EST 2000
On Fri, Aug 04, 2000 at 11:34:07AM -0400, Subba Rao wrote:
>
> PS1='($?)\u@\h:\w =>'
> PS1='($?)`whoami`@\h:\w =>'
> In BASH, why does the "\u" and "whoami" make a big difference for
> the $? value in PS1 string? The BASH version is 2.04.
My assumption is that using whoami with the ` ` causes it to need to
reevaulate the PS1 enviroment variable every time. During the
reevaulation of PS1, it updates $? along with it. While using \u is
handled internally by the shell. $? is only evaluated when PS1 is
set.
--
Dan Nguyen | It is with true love as it is with ghosts;
nguyend7 at msu.edu | everyone talks of it, but few have seent it.
dnn at debian.org | -Maxime De La Rochefoucauld
More information about the Techtalk
mailing list