In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is the difference between source, sh, bash,. / script execution under ubuntu". In daily operation, I believe many people have doubts about the difference between source, sh, bash and. / execution script under ubuntu. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the questions of "what is the difference between source, sh, bash,. / execution script under ubuntu"! Next, please follow the editor to study!
Differences between source, sh, bash,. / script execution under ubuntu
1.source command usage:
Source FileName
Purpose: to read and execute commands in FileName in the current bash environment. The filename file may not have "execute permission"
Note: this command usually uses the command "." To replace it.
Such as: source .bash _ profile
. .bash _ profile is equivalent.
The source (or dot) command is usually used to re-execute the initialization document that has just been modified.
The source command (from C Shell) is a built-in command for bash shell.
A dot command is a dot symbol (from Bourne Shell).
The program body of source is bash, and the value of the $0 variable in the script is bash, and because it acts on the current bash environment, the variable set in the script will take effect directly.
2. Command usage of sh, bash:
Sh/bash FileName
Function: open a child shell to read and execute commands in FileName. The filename file may not have "execute permission"
Note: running a shell script starts another command interpreter.
Each shell script runs effectively in a child process of the parent shell (parent shell).
The parent shell is the process that gives you command indicators in a control terminal or in a xterm window.
The shell script can also start its own child process.
These sub-shell (that is, child processes) enable scripts to run multiple subtasks within the script simultaneously and efficiently.
In ubuntu, sh is just a link to bash.
Because it is executed in a child shell, the variables set by the script do not affect the current shell.
3. / command usage:
. / FileName
Function: open a child shell to read and execute commands in FileName. The filename file requires "execute permission"
Note: running a shell script starts another command interpreter.
Each shell script runs effectively in a child process of the parent shell (parent shell).
The parent shell is the process that gives you command indicators in a control terminal or in a xterm window.
The shell script can also start its own child process.
These sub-shell (that is, child processes) enable scripts to run multiple subtasks within the script simultaneously and efficiently.
Because it is executed in a child shell, the variables set by the script do not affect the current shell.
At this point, the study on "what is the difference between source, sh, bash,. / script execution under ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.