In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Overview
In computer science, Shell, commonly known as shell (used to distinguish it from kernel), refers to software (command parser) that "provides the user with an interface". It is similar to command.com under DOS and later cmd.exe. It receives user commands and then invokes the appropriate application.
Application scenario
Shell script is a program file that saves the executed commands to a text file in order and changes the executable permissions of the file to facilitate one-time execution. It is often used for repetitive operations, batch transaction processing, automatic operation and maintenance, service running status monitoring, timing task execution, and so on.
Programming specification
Shell script in Linux system is a special application, which is between the operating system kernel and the user, and acts as a "command interpreter". You can learn about the types of Shell scripts supported by the current system through the / etc/shells file. Where / bin/bash is the default Shell script used by most Linux versions.
Shell script execution command
. / sh. Space cource
Executing the script with. / and sh does not change the current path. And. Spaces and source execution can change the path. When you use. / execute a shell script, you need to give the script execution permission.
Sh execution
. / execution
Source execution
. White space execution
Piping and redirection
In the image above, the result of the previous command is passed to the later command program when the pipe symbol is used. Awk is displayed vertically, and $1 is the first and seventh location variables. -F: indicates separated by a colon.
Custom variable
A variable defined by a user when customizing a variable is valid only in the user's own shell environment, so it is also called a local variable.
The basic format is "variable name = variable value", and the variable name should start with a letter or an underscore.
Read a line from the standard input device and assign a value to the variable, using the read command
Location variable
$
Predefined variable
Users can only use predefined variables, but they cannot create predefined variables or directly assign values to predefined variables. Predefined variables are represented by a combination of the $symbol and another symbol.
$#: indicates the number of position parameters on the command line
$*: indicates the contents of all location parameters
$?: indicates that the status is returned after the command is executed. 0 means the execution is correct, and a non-0 indicates that the execution is abnormal
$0: indicates the name of the currently executed script or program
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: 214
*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.