A bit different before for the `bg` command in zsh vs. bash

Today I observed strange behavior, I hope that I can find some direction.

That's what I'm doing...

If at least one process is already running in the background, I interrupt the ( Ctrl+ Z) foreground process and then put it in the background with bg.

Below are the results in zsh:

$ some-long-running-command
^Z
zsh: suspended  some-long-running-command
$ bg
[2]  - continued  some-long-running-command
$ jobs
[1]  + running    other-command-previously-run
[2]  - running    some-long-running-command
$

And here is what it looks like in bash:

$ other-command-previously-run &
[1] 12345
$ some-long-running-command
^Z
[2]+  Stopped                 some-long-running-command
$ bg
[2]+ some-long-running-command &
$ jobs
[1]-  Running                 other-command-previously-run &
[2]+  Running                 some-long-running-command &
$ 

, bash bg "" ( "+", , fg), zsh "" ? - , , ... , fg + ^Z + bg zsh, "" "flip flop".

- ?

+5
1

bash zsh.

My TL; DR : , bash, . , zsh, ( ), , .


Bash

Bash , 7, " " bg:

"%%" "% +" , , , .

, bash , , . , :

, bash , bg ""


: zsh. man zshmisc JOBS , zsh + - JOBS

%% .
% + %%.
% - .

, bg, fg ^Z previous current.

, , irc.freenode.net#zsh, , zsh " "; bg current . , :


simont@charmander ~/repositories/SOTesting/bg
  $ one.sh&                                                                                 [1:52:41]
[1] 98369

simont@charmander ~/repositories/SOTesting/bg
  $ two.sh&                                                                                 [1:52:49]
[2] 99293

simont@charmander ~/repositories/SOTesting/bg
  $ three.sh                                                                                [1:52:51]
^Z
[3]  + 973 suspended  three.sh

simont@charmander ~/repositories/SOTesting/bg
  $ jobs                                                                                    [1:52:55]
[1]    running    one.sh
[2]  - running    two.sh
[3]  + suspended  three.sh

simont@charmander ~/repositories/SOTesting/bg
  $ bg                                                                                      [1:52:57]
[3]  - 973 continued  three.sh

simont@charmander ~/repositories/SOTesting/bg
  $ jobs                                                                                    [1:52:59]
[1]    running    one.sh
[2]  + running    two.sh
[3]  - running    three.sh

, one two . three, (?) - current process, + JOBS.
three , , bg previous two, "" "" current .

, , ; , , , , man zsh* ; , - .

+3

All Articles