bash脚本 - 什么“ls ..”(带双点的ls)呢?

问题描述 投票:-4回答:1

我的作业让我找到了ls ..的作用。

我试图搜索互联网,但我找不到任何问题的答案。

有人知道这个命令的作用吗?

bash ls
1个回答
-1
投票

..是当前目录中的一个条目,它引用当前目录的父目录。这不是ls所使用的特殊约定。例如:

$ cd /usr/bin
$ pwd
/usr/bin
$ cd ..
$ pwd
/usr
$ [ -d .. ] && echo "It's a directory"
It's a directory
$ stat ..
<output specific to your installed version of stat>
© www.soinside.com 2019 - 2024. All rights reserved.