In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-08 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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.