You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
890 B

6 years ago
# pushd
7 years ago
6 years ago
## 说明
7 years ago
6 years ago
**pushd命令** 是将目录加入命令堆叠中。如果指令没有指定目录名称,则会将当前的工作目录置入目录堆叠的最顶端。置入目录如果没有指定堆叠的位置,也会置入目录堆叠的最顶端,同时工作目录会自动切换到目录堆叠最顶端的目录去
7 years ago
6 years ago
## 选项
7 years ago
6 years ago
```info
-n 只加入目录到堆叠中不进行cd操作
+N 删除从左到右的第n个目录数字从0开始
-N 删除从右到左的第n个目录数字从0开始
7 years ago
```
### 实例
6 years ago
```sh
# 参数--目录:需要压入堆栈的目录。
7 years ago
root@Mylinux:/tmp/dir4# pushd /tmp/dir3
/tmp/dir3 /tmp/dir4 /tmp/dir1 ~
root@Mylinux:/tmp/dir3# pushd /tmp/dir2
/tmp/dir2 /tmp/dir3 /tmp/dir4 /tmp/dir1 ~
root@Mylinux:/tmp/dir2# pushd -1
/tmp/dir1 ~ /tmp/dir2 /tmp/dir3 /tmp/dir4
6 years ago
# 注意:最左边表示栈顶,最右边表示栈底。
7 years ago
```