Sim, você pode:
- Pause o trabalho atualmente em execução com o suspender caractere pressionando Ctrl + Z .
- Digite
fg
ou%
, adicione o que você deseja à lista e execute-a, por exemplo:
Comofg ; systemctl suspend # or % ; systemctl suspend
fg
retorna o valor de retorno do job, os operadores de lista como&&
e||
funcionam como esperado:fg && echo "Finished successfully!" # or % && echo "Finished successfully!"
man bash
/ JOB CONTROL diz sobre o caractere de suspensão :
Typing the suspend character (typically
^Z
, Control-Z) while a process is running causes that process to be stopped and returns control tobash
. (…) The user may then manipulate the state of this job, using thebg
command to continue it in the background, thefg
command to continue it in the foreground, or thekill
command to kill it. A^Z
takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded.
fg
é explicado em man bash
/ SHELL BUILTIN COMMANDS :
fg [jobspec]
Resume jobspec in the foreground, and make it the current job. If jobspec is not present, the shell's notion of the current job is used. The return value is that of the command placed into the foreground, or failure if run when job control is disabled or, when run with job control enabled, if jobspec does not specify a valid job or jobspec specifies a job that was started without job control.
Leitura adicional (além de man bash
) no controle de trabalho: