Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: disown -a
- X-seq: zsh-users 26564
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: zzapper <zsh@xxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: disown -a
- Date: Wed, 03 Mar 2021 00:05:38 +0000
- Archived-at: <https://zsh.org/users/26564>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-03/28c28f42-632d-4ebc-857e-64022f59a895%40www.fastmail.com>
- In-reply-to: <f1f6fef5-c98d-2958-e315-4139061ab3f9@rayninfo.co.uk>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xAHJ-cejSmsrZcThJ-dDWStApAY=QukV1ivYpvb1idNWA@mail.gmail.com> <f1f6fef5-c98d-2958-e315-4139061ab3f9@rayninfo.co.uk>
zzapper wrote on Tue, 02 Mar 2021 23:31 +00:00:
> Confused as to whether disown behaves differently between zsh & bash
>
Presumably you mean "why" rather than "whether". About that, see
https://github.com/zsh-users/zsh/blob/5ede2c55f144593c16498c3131a76e188114a9c6/Etc/FAQ.yo#L2056-L2102,
the first and penultimate paragraphs.
More below.
> in zsh
>
> >disown -a
> disown: job not found: -a
>
>
> bash
>
> david@mint-HP-600B $ sleep 200
> ^Z
> [1]+ Stopped sleep 200
> david@mint-HP-600B $ disown -a
> bash: warning: deleting stopped job 1 with process group 47533
>
>
> I desire to use disown -a in zsh but it's not working and not documented
zsh is not a bug-for-bug reimplementation of bash.
As to a workaround, you don't specify what -a should do, but perhaps this:
disown %${(k)^jobstates[(R)suspended:*]}
The references for that are spread across several parts of the manual
(zshexpn(1) for ${^foo}, zshmodules(1) for $jobstates, etc), but in a
nutshell, it disowns the jobs that are listed as "suspended" in
$jobstates.
You can even syntactic sugar that:
function disown() {
if [[ $# -eq 1 && #1 == -a ]] ; then set -- %${(k)^jobstates[(R)suspended:*]} ; fi
builtin disown "$@"
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author