In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the knowledge of Shell variables, the article is very detailed, has a certain reference value, interested friends must read it!
Shell is a program written in C language, which is a bridge for users to use Linux. Shell is not only a command language, but also a programming language, which covers many and complex knowledge points, but it is one of the technologies that cloud computing developers must master.
Variables in Linux Shell can be specified as any data type, such as text strings or numeric values. You can also change the style of Shell by changing the variables in Shell.
Shell supports three ways to define variables:
Variable=value
Variable='value'
Variable= "value"
Variable is the name of the variable and value is the value assigned to the variable. If the value does not contain any white space characters (such as spaces, Tab indentation, and so on), then you can not use quotation marks; if the value contains white space characters, then you must enclose them in quotation marks. Note that there can be no spaces around the assignment sign =.
The naming convention for Shell variables is the same as in most programming languages: variable names consist of numbers, letters, and underscores; they must start with letters or underscores; and keywords in Shell cannot be used (reserved keywords can be seen through the help command).
Shell variables in Linux are divided into system variables and user-defined variables. System variables include $HOME, $PWD, $SHELL, $USER, echo $SHELL, and display all variables set in the current Shell.
Shell custom variables include 1) define variables: variables = value; 2) undo variables: unset variables; 3) declare static variables: readonly variables, note that you cannot unset;4) use export to promote variables to global environment variables, such as the TOMCAT_HOME variable in / etc/profile, and use this environment variable in other / opt/tmp/shell/myShell.sh scripts.
Shell sets environment variables
Basic syntax:
1) export: variable name = variable value (function description: output shell variable as environment variable)
2) source: configuration file (function description: make the modified configuration file take effect immediately)
3) echo:$ variable name (function description: query the value of the environment variable)
Single-line comments: #
Multiline comments: Shell scripts are suitable for dealing with plain text data, while almost all configuration files, log files (such as NFS, Rsync, Httpd, Nginx, MySQL, etc.), and most startup files in Linux are plain text files. Shell is a skill that operation and maintenance personnel must master, as well as Linux, information security, Docker container and so on.
The above is all the content of this article "what is the knowledge of Shell variables?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.