Home  >  Article  >  Operation and Maintenance  >  The difference between linux .and ..

The difference between linux .and ..

(*-*)浩
(*-*)浩Original
2019-11-04 09:32:244183browse

The difference between linux .and ..

. (dot, is "dot") (Recommended learning: linux operation and maintenance)

In the shell , users should all know that One dot represents the current directory, and two dots represent the upper directory.

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

In the upstream 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 the -a option must be added to the ls command to display it. In addition, in regular expression, a dot represents matching one character.

In Linux, when . (dot) is placed at the parameter of a command that requires a directory name, it means "current directory"; and two dots (..) one immediately following the other Well, in the same scenario (i.e. when your command expects a directory of files) it means "the parent directory of the current directory".

The dot command in the Linux shell is completely equivalent to the source command.

[taoge@localhost Desktop]$ cat a.sh 
#! /bin/bash
echo "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 $z
f(x) + f(y)
[taoge@localhost Desktop]$

We see that the point command is indeed equivalent to the source command. Please pay attention to ". ./a.sh". The first dot is a command, which is equivalent to source. The last dot is together with /. ./ represents the current directory. Moreover, be sure to pay attention to these two dots. There must be a space between them.

The above is the detailed content of The difference between linux .and ... For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn