Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-02 21:27:32 11月15日 Update

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.

Tags: Directory command representative two file clear name that is equivalent help special upper layer between function user content parameter scene this beginning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Docker MariaDB OPPO Reno NVidia