zzh@ZZHPC:~$ sleep 120 ^Z [1]+ Stopped sleep 120 zzh@ZZHPC:~$ bg %1 [1]+ sleep 120 & zzh@ZZHPC:~$ [1]+ Done sleep 120
10:01开始sleep,执行完后立刻执行Ctrl + Z中止。
10:02执行bg %1 (bg sleep也可以)来resume sleep进程。
10:03 sleep进程完成。
这说明进程中止期间的时间也算在sleep内,不会重新从resume那一刻起sleep剩余的时间。
zzh@ZZHPC:~$ bg --help
bg: bg [job_spec ...]
Move jobs to the background.
Place the jobs identified by each JOB_SPEC in the background, as if they
had been started with `&'. If JOB_SPEC is not present, the shell's notion
of the current job is used.
Exit Status:
Returns success unless job control is not enabled or an error occurs.
zzh@ZZHPC:~$ fg --help
fg: fg [job_spec]
Move job to the foreground.
Place the job identified by JOB_SPEC in the foreground, making it the
current job. If JOB_SPEC is not present, the shell's notion of the
current job is used.
Exit Status:
Status of command placed in foreground, or failure if an error occurs.
zzh@ZZHPC:~$ sleep 120 ^Z [1]+ Stopped sleep 120 zzh@ZZHPC:~$ bg sleep [1]+ sleep 120 & zzh@ZZHPC:~$ fg sleep sleep 120 zzh@ZZHPC:~$
标签:ZZHPC,Shell,120,job,bg,sleep,zzh From: https://www.cnblogs.com/zhangzhihui/p/17609158.html