Some understanding of Bash command

 

i.e. corresponding to each command in bash of a document can be used to query the location where the command file according to which.

Commonly used ls, cp commands are stored / usr / bin, it is possible to view the position command file is located by Which [command]. (Cd command no file, via a bash achieved)
when use ls view files, can also be used / usr / bin / ls such an order.


Bash execution rules
bash to find the file, there are two ways.
The first is the path to come: for example, we have entered / or path and other symbols have meaning, it will start looking for the path from the
second, is the direct directory set in the environment variable to find.

For example, we enter in a terminal of xxxxx this strange command.
Path system variable terminal will go has been set inside, to find the file that is called xxxxx name according to the order set in order to find / usr / local / bin:. / Bin: / usr / bin (system variables: split)
when all of the folders inside it can not find the xxxxx file.
Tip: command not found.

Next, we just set up a system variable to create a folder xxxxx file.

Xxxxx execute the command again.
Tip: insufficient privileges.

After the file you just created does not add permissions, increased execute permissions
Tip: asdf command not found (asdf is what I just created xxxxx file when random input)
that is, in the implementation of the file, will still go looking for the command.


Add a single line in xxxxx, the Python interpreter address. Execution again
directly run python.


Well, this also explains why we write code, preceded by the address interpreter, but different is that, if written directly address parser, then directly open interpreter (behind text command will continue to perform in an interpreter when closed).
need to address the interpreter's special comment # !, said it would file the following contents which passed for execution.

Some understanding of Bash command

Guess you like

Origin www.cnblogs.com/jrri/p/12114010.html