Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: pipe issues with 'jobs' command



Le Wang wrote:
>getJobCount () {
>  print "$#jobtexts";
>}
>
>prompt_le1_precmd () {
>  PS1="$(getJobCount) %# "
>  PS2="%_> "
>  PS3="?# "
>}
>--------------
>
>If I call getJobCount from the shell directly (e.g.
>execute the command 'getJobCount'), I get the real
>number of jobs, but my prompt always prints 0.  What's
>going on here?

$() also creates a subshell.

You might find psvar and the %v prompt sequence helpful.

-zefram



Messages sorted by: Reverse Date, Date, Thread, Author