Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `jobs' builtin does not work with pipe in scripts
- X-seq: zsh-workers 28458
- From: ZyX <zyx.vim@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: `jobs' builtin does not work with pipe in scripts
- Date: Fri, 26 Nov 2010 21:16:14 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=BzHkxUOxbpKOO9+R84nK/nkHrK+ScoGqQ/8XkNAyVaY=; b=wWCBB+ceBNT1jNRtMNU3DTqMqsD+ByPocJaGTELdwZODbieyJ+LG0JzLPKY2RBh71/ 7AjfSzLFLKMNpEXl2jv8G7Ve9EkLDYg8r5Fmw8bYKU+v6Fd5fk7I5uv7WW6NWBKDhTiz 0ibuXHZqBpiE8jdtpPhrH27dJo73ZzaOvDMUI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=vTDP0o+2V3PAVUEPQexwkp4NxX7jCUWa3lUoZZJ7mytCV6JavoER0bROuBwbQXy9Cm hHOzh+lu35vHAbvMX3GIgvIQzoz5FpjR541SWgKgg6hDDWLes5/ylIOj3u0tZvvroCTz LecSAXnd/JHFAG5rE9t/IovQ+09R0lsVir22A=
- In-reply-to: <101126094739.ZM25971@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <201011252341.44512@-zyx> <201011260738.12563@-zyx> <101126094739.ZM25971@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: zyx.vim@xxxxxxxxx
Reply to message «Re: `jobs' builtin does not work with pipe in scripts»,
sent 20:47:39 26 November 2010, Friday
by Bart Schaefer:
What is your version of zsh? It does not work for me:
(zyx:~) % zsh -fc 'sleep 3 & fg'
zsh:fg:1: no job control in this shell.
(zyx:~) % zsh -omonitor -fc 'sleep 3 & fg'
zsh:fg:1: no job control in this shell.
(zyx:~) % zsh -fc 'setopt monitor;sleep 3 & fg'
zsh:setopt:1: can't change option: monitor
zsh:fg:1: no job control in this shell.
And if zsh does not provide job control without this option, why `jobs' works as
expected without pipe?
Original message:
> On Nov 26, 7:38am, ZyX wrote:
> }
> } What more? `jobs -p | ...' is not working
>
> If you want "jobs" to do something reliable, you have to set the
> MONITOR option. Zsh by default does not provide job control in a
> non-interactive shell.
>
> % zsh -fc 'sleep 3 & fg'
> zsh:fg:1: no job control in this shell.
> % zsh -fc 'setopt monitor; sleep 3 & fg'
> [1] 25945
> [1] + running sleep 3
> % zsh -fc 'sleep 3 & jobs -p | sed s/run/RUN/'
> % zsh -o monitor -fc 'sleep 3 & jobs -p | s/run/RUN/'
> [1] 25967
> [1] + 25967 RUNning sleep 3
> %
Attachment:
signature.asc
Description: This is a digitally signed message part.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author