从子shell的任意深度跳到顶部父shell

时间:2018-10-25 08:53:30

标签: bash

我创建了多个子外壳

$ ps -f
  UID   PID  PPID   C STIME   TTY           TIME CMD
  501  2659  2657   0  8:22AM ttys000    0:00.15 -bash
  501  2776  2659   0  8:23AM ttys000    0:00.02 bash
  501  2778  2776   0  8:23AM ttys000    0:00.09 bash
  501  3314  2778   0  9:13AM ttys000    0:00.26 bash
  501  8884  3314   0  4:41PM ttys000    0:00.03 /bin/bash
  501  8891  8884   0  4:41PM ttys000    0:00.01 /bin/bash
  501  8899  8891   0  4:41PM ttys000    0:00.02 /bin/bash
  501   423   408   0  7:16AM ttys001    0:00.22 -bash
  501  8095   423   0  3:52PM ttys001    0:00.15 ssh root@www.****.com
  501  8307  8303   0  4:05PM ttys002    0:00.17 -bash

我想跳回最靠前的那一列,但必须尝试一一退出

$ ps -f
  UID   PID  PPID   C STIME   TTY           TIME CMD
  501  2659  2657   0  8:22AM ttys000    0:00.17 -bash
  501   423   408   0  7:16AM ttys001    0:00.22 -bash
  501  8095   423   0  3:52PM ttys001    0:00.15 ssh root@***.com
  501  8307  8303   0  4:05PM ttys002    0:00.17 -bash

我检查了还剩3个篮子,所以我继续

$ exit
logout
Saving session...completed.

[Process completed]

悲伤,这是我遇到的最多情况,如何从任意深度的subshel​​l跳到顶部?

0 个答案:

没有答案