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

Re: named jobs in RPROMPT



On Sep 20,  7:27am, Daniel wrote:
} Subject: Re: named jobs in RPROMPT
}
}   setopt promptsubst
} Now consider:
}   RPROMPT='"$jobstates"'
} and
}   my_jobs() { print $jobstates }
}   RPROMPT='"$(my_jobs)"'
} 
} The first one display the jobstates array, the second doesn't.

That's because $(...) is a subshell which has no jobs of its own.
Consider:

    sleep 10 & print $jobtexts
    print $(sleep 3 >/dev/null & print $jobtexts)
    print $jobtexts

} My idea is to have my_jobs print a very compact list of jobs, fitting in
} the right prompt.

Instead of having my_jobs print the list to stdout, which forces you
to create a sub-process whose output can be captured, just have my_jobs
assign the list directly to RPROMPT.



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