Мне любопытно, как я могу сначала убить все запущенные задания, а затем изменить статус всех остановленных заданий на состояние выполнения в Linux. Я много гуглил, но ничего не нашел. Я только что набрал команду kill $(jobs -ps)
, которая убивает все задания (запущенные или остановленные). Это мой jobs
результат:
[1] 92231 Running tail -f myfile &
[2] 92232 Stopped tail -f myfile
[3] 92234 Stopped tail -f myfile
[4] 92236 Stopped tail -f myfile
[5] 92237 Running tail -f myfile &
[6] 92238 Stopped tail -f myfile
[7] 92239 Running tail -f myfile &
[8] 92240 Stopped tail -f myfile
[9] 92241 Stopped tail -f myfile
[10] 92243 Stopped tail -f myfile
[11] 92244 Stopped tail -f myfile
[12] 92245 Stopped tail -f myfile
[13] 92246 Stopped tail -f myfile
[14] 92247 Stopped tail -f myfile
[15] 92248 Stopped tail -f myfile
[16] 92249 Stopped tail -f myfile
[17] 92250 Stopped tail -f myfile
[18] 92251 Stopped tail -f myfile
[19] 92252 Stopped tail -f myfile
[20] 92253 Stopped tail -f myfile
[21] 92255 Stopped tail -f myfile
[22] 92256 Stopped tail -f myfile
[23] 92258 Stopped tail -f myfile
[24] 92259 Stopped tail -f myfile
[25] 92260 Stopped tail -f myfile
[26] 92261 Running tail -f myfile &
[27] 92262 Stopped tail -f myfile
[28] 92263 Stopped tail -f myfile
[29] 92264 Stopped tail -f myfile
[30] 92267 Stopped tail -f myfile
[31] 92268 Stopped tail -f myfile
[32] 92269 Stopped tail -f myfile
[33] 92270 Stopped tail -f myfile
[34] 92271 Stopped tail -f myfile
[35]- 92272 Stopped tail -f myfile
[36]+ 92273 Stopped tail -f myfile
Сначала я хочу убить все запущенные процессы, а затем я хочу, чтобы другие остановленные процессы были запущены.
Как я могу достичь этого выхода? Я думал о l oop, но не уверен, смогу ли.