Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Is there any difference between & quot;." and & quot;.." in linux?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In linux "." And ".." Is there a difference? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

. (dot, which means "point")

In shell, users should be aware that one dot represents the current directory and two dot represent the upper directory.

CDPATH=.:~:/home:/home/web:/var:/usr/local

In the uplink CDPATH setting, the dot after the equal sign represents the current directory.

If the file name starts with dot, the file is a special file and must be displayed with the-an option in the ls directive. In addition, in regularexpression, a dot represents a match to a character.

Linux Zhongdang. (dot) when placed at the argument of a command that requires a directory name, it means "current directory", while one followed by two dots (.) In the same scenario (that is, when your command expects a file directory), it means "parent directory of the current directory".

The dot command in linux shell is exactly equivalent to the source command.

[taoge@localhost Desktop] $cat a.sh #! / bin/bashecho "shell script" export z = "f (x) + f (y)" [taoge@localhost Desktop] $. / a.sh shell script [taoge@localhost Desktop] $echo $z [taoge@localhost Desktop] $. . / a.sh shell script [taoge@localhost Desktop] $echo $zf (x) + f (y) [taoge@localhost Desktop] $

We can see that the point command is indeed equivalent to the source command. Please note that ".. / a.sh", the first dot is the dot command, which is equivalent to source, the latter dot is with /,. / indicates the current directory, and, please note, there must be a space between the two dots.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report