linux - bash:上次访问的路径是否有任何类型的缓冲区?

标签 linux bash terminal

看看这个步骤:

:~$ cd programacion/
:~/programacion$ cd sports/
:~/programacion/sports$ cd src/
:~/programacion/sports/src$ cd Sports/
:~/programacion/sports/src/Sports$ cd PlatformBundle/
:~/programacion/sports/src/Sports/PlatformBundle$ cd Entity/
:~/programacion/sports/src/Sports/PlatformBundle/Entity$ cd /
:/$ 

此时此刻在最后一个提示中,有什么方法可以直接转到 programacion/sports/src/Sports/PlatformBundle/Entity 因为它是我访问的最后一条路径?

最佳答案

您可以使用以下快捷方式到最后一个目录:

cd -

例如:

kbrandt@alpine:~$ pwd
/home/kbrandt
kbrandt@alpine:~$ cd src
kbrandt@alpine:~/src$ cd -
/home/kbrandt
kbrandt@alpine:~$ cd -
/home/kbrandt/src
kbrandt@alpine:~/src$ 

另一种选择是使用 $OLDPWD shell 变量。

关于linux - bash:上次访问的路径是否有任何类型的缓冲区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10398779/

相关文章:

bash - 如何根据变量的值向命令添加额外的参数?

bash - 为什么 $RANDOM 不是很随机?

macos - 是否可以使用SSH复制文件的一部分?

linux - 使用 Incrond Inotify 但遇到用户组/权限问题

linux - BASH 空白别名到 'cd'

Git - 在 github 上使用端口 9418 进行远程操作

linux重命名多个非utf-8的文件

Java数组: 2D array dysfunction in terminal ASCII terminal game during attempt to swap elements

linux -/usr/bin/ld : cannot find -lemu

linux - Linux _x86_64 命令信息中的 GDB 调试