zsh-users
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: zzapper <zsh@rayninfo.co.uk>, zsh-users@zsh.org
Subject: Re: disown -a
Date: Wed, 03 Mar 2021 00:05:38 +0000	[thread overview]
Message-ID: <28c28f42-632d-4ebc-857e-64022f59a895@www.fastmail.com> (raw)
In-Reply-To: <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 "$@"
}


  reply	other threads:[~2021-03-03  0:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 11:34 quonting and globbing Pier Paolo Grassi
2021-03-02 11:58 ` Mikael Magnusson
2021-03-02 12:24   ` Pier Paolo Grassi
2021-03-02 23:31 ` disown -a zzapper
2021-03-03  0:05   ` Daniel Shahaf [this message]
2021-03-03  7:15     ` Stephane Chazelas
2021-03-03  7:57       ` Pier Paolo Grassi
2021-03-03 10:23         ` Finding out where features come from (Was: disown -a) Stephane Chazelas
2021-03-03 14:00           ` Pier Paolo Grassi
2021-03-03 14:45             ` Pier Paolo Grassi
2021-03-03  9:36       ` disown -a zzapper
2021-03-03  9:40         ` Peter Stephenson
2021-03-03 20:12         ` Daniel Shahaf
2021-03-03  0:12   ` Daniel Shahaf
2021-03-03 10:17     ` zsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28c28f42-632d-4ebc-857e-64022f59a895@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-users@zsh.org \
    --cc=zsh@rayninfo.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).