⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jobs.tests

📁 android-w.song.android.widget
💻 TESTS
字号:
# test out %+, jobs -p, and $! agreement in a subshell first${THIS_SH} ./jobs1.sub# test out fg/bg failure in a subshell${THIS_SH} ./jobs2.sub# test out behavior of waiting for background pids -- bug in versions# before 2.03${THIS_SH} ./jobs3.sub# test out behavior of using job control notation when job control is not# active${THIS_SH} ./jobs4.subjobsecho $?# a no-such-job error, since we can use job control notation without job controlwait %1# make sure we can't fg a job started when job control was not activesleep 30 &pid=$!fg %1# make sure the killed processes don't cause a messageexec 5>&2exec 2>/dev/nullkill -n 9 $pidwait    # make sure we reap the processes while stderr is still redirectedexec 2>&5echo wait-for-pidsleep 10 &wait $!echo wait-errorswait 1-1wait -- -4echo wait-for-background-pidssleep 5 &sleep 8 &waitecho async list wait-for-background-pidssleep 5 & sleep 8 &waitecho async list wait for childsleep 5 & echo forkedwaitecho wait-when-no-childrenwaitset -mecho wait-for-jobsleep 5 &wait %2		# this should be a no-such-job errorecho $?wait %1echo async list wait-for-jobsleep 5 & echo forkedwait %1echo fg-bg 1sleep 5 &%1echo fg-bg 2sleep 5 &fg %%echo fg-bg 3sleep 5 &fg %secho fg-bg 4sleep 5 &fg %?ee# these next two are error casesecho fg-bg 5sleep 15 &fg %2		# this should be a no-such-job errorbg %1		# this should be a `bg background job?' errorwait# these may someday mean to start the jobs, but not print the line# describing the status, but for now they are errorsecho fg-bg 6sleep 5 &fg -s %1bg -s %1wait# someday this may mean to disown all stopped jobs, but for now it is# an errordisown -s# this is an error -- the job with the pid that is the value of $! is# retained only until a `wait' is performeddisown %1# this, however, is an errordisown %2echo wait-for-non-childwait 1echo $?exit 1 | exit 2 | exit 3echo $? -- ${PIPESTATUS[@]} -- ${PIPESTATUS[0]} - ${PIPESTATUS[1]} - ${PIPESTATUS[2]}sleep 300 &sleep300pid=$!sleep 350 &sleep 400 &jobsecho running jobs:jobs -r# should be an errorkill -n 1 %4# should be an errorjobs %4echo current job:jobs %+echo previous job:jobs %-kill -STOP %2sleep 5	# give time for the shell to get the stop notificationecho after kill -STOPecho running jobs:jobs -recho stopped jobs:jobs -sdisown %1echo after disownjobsecho running jobs:jobs -recho stopped jobs:jobs -skill -s CONT %2echo after kill -s CONTecho running jobs:jobs -recho stopped jobs:jobs -skill -STOP %3sleep 5	# give time for the shell to get the stop notificationecho after kill -STOP, backgrounding %3:bg %3disown -h %2# make sure the killed processes don't cause a messageexec 5>&2exec 2>/dev/nullecho killing...kill -n 9 $sleep300pidkill -n 9 %2 %3wait	# make sure we reap the processes while stderr is still redirectedecho doneexec 2>&5sleep 10 &kill -STOP %1sleep 5	# give time for the shell to get the stop notificationecho after KILL -STOP, foregrounding %1fg %1echo done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -