* How to restore $? AND $_ ?
@ 2019-07-24 6:20 Sebastian Gniazdowski
2019-07-24 6:29 ` Sebastian Gniazdowski
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 6:20 UTC (permalink / raw)
To: Zsh hackers list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to restore $? AND $_ ?
2019-07-24 6:20 How to restore $? AND $_ ? Sebastian Gniazdowski
@ 2019-07-24 6:29 ` Sebastian Gniazdowski
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-24 6:29 UTC (permalink / raw)
To: Zsh hackers list
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@gmail.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-24 6:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 6:20 How to restore $? AND $_ ? Sebastian Gniazdowski
2019-07-24 6:29 ` Sebastian Gniazdowski
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).