No, this is not another bug report.

    I've been experimenting with the discipline function PS1.get. It has
the advantage that it can place more dynamic information in the prompt
than the variable. For instance, it's possible to get the current load
average in the prompt with PS1.get.

    The main drawback is that $? then gets set from the return value of
PS1.get. So, if PS1.get is defined, $? must be viewed/obtained before
the prompt reappears. It would be nice if $? could be saved just after
the current command executes but before PS1.get executes, then restored
after PS1.get finishes.

    Here's a demonstration of putting the load average into the prompt
with PS1.get:

$ function PS1.get
> {     typeset IFS=,
>       typeset -a uptime=($(uptime))
>
>       .sh.value="${uptime[${#uptime[@]} - 1]} $ "
>       }
 load averages: 0.97 1.32 0.98 $ false
 load averages: 1.12 1.34 0.99 $ echo $?
0
 load averages: 1.03 1.31 0.99 $ false; echo $?
1
 load averages: 0.87 1.27 0.98 $ unset -f PS1.get
PS1='$ '
$


                    Terrence Doyle
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to