bash shell miscellaneous notes (3) - execute scripts and shell variables

Let's say we wrote a simple script, how do we execute it?

execute script

We can execute scripts in three ways.
.pro , note that there is a space after the
click./pro
/pro
Here, we must first understand the environment variables of linux

forlinx@ubuntu:/$ export PATH=$PATH:.
forlinx@ubuntu:/$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

We can see that the listed directories are the default environment variables of the system. As long as the commands in these directories are used, we can use them directly without a path. For example, we use ls for this reason.
To use the first method we listed above, you need to add a . to the environment variable, use the following method

forlinx@ubuntu:/$ 

Guess you like

Origin blog.csdn.net/mainmaster/article/details/131640921