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

Re: How to restore $? AND $_ ?



False alarm – Zsh pushes the $_ values onto some kind of stack:

() { : test2 } test1; echo $_
test1

so appending $_ to the sched's argument is sufficient.

On Wed, 24 Jul 2019 at 08:20, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> Hello,
> consider the following:
>
> sched-fun() {
>     # UND=$_
>     local ret=$?
>
>     sched +1 "sched-fun \$_"
>
>     # : $UND
>     return $ret
> }
>
> The point is that the 2 commented lines must be run in the same place
> as the next lines after them in order to work. No way out of this
> problem? It is about not disrupting user session with background
> tasks, I think that this is in general important.
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org



-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



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