简体   繁体   English

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

[英]bash scripting - what does "ls .." (ls with double dot) do?

My homework asked me to find what ls .. does.我的作业要求我找出ls ..作用。

I tried to search the internet but I couldn't find any answer to the question.我试图在互联网上搜索,但我找不到任何问题的答案。

Does someone know what this command does?有人知道这个命令是做什么的吗?

.. is an entry in the current directory that refers to the parent of the current directory. ..是当前目录中的一个条目,它指的是当前目录的父目录。 It's not a special convention used just by ls .这不是仅由ls使用的特殊约定。 For example:例如:

$ 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM