In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "what is the meaning of $in linux shell". The editor shows you the operation process through an actual case. The operation method is simple and fast, and it is practical. I hope this article "what is the meaning of $in linux shell" can help you solve the problem.
In linux, shell is a command line interpreter, and "$$" means the PID of the current shell, that is, the current process number under which the script is running; the function of shell is to interpret the input commands and transmit them to the system, providing the user with a program to send requests to linux.
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What does $$mean in linux's shell?
Shell is a command line interpreter, its function is to follow a certain syntax to interpret the input commands and pass them to the system. It provides users with an interface system-level program that sends requests to Linux to run programs. Users can use Shell to start, suspend, stop or even write some programs.
$PID of the current shell (that is, the current process number under which the script is running)
Shell itself is a bridge for users to use Linux. Shell is both a command language and a programming language (what you call shell scripts). As a command language, it interactively interprets and executes commands entered by users; as a programming language, it defines a variety of variables and parameters, and provides many control structures that are unique in high-level languages, including loops and branches.
Although it is not part of the Linux system kernel, it invokes most of the functions of the system kernel to execute programs, create documents, and coordinate the running of each program in parallel.
Knowledge expansion:
$0 the execution name of the current script
N the nth parameter value of the current script execution command, n = 1. 9
$* all parameters of the command executed by the current script. This option can have more than 9 parameters.
$# the number of input parameters of the current script execution command, such as execution. / test.sh aa bb cc, $# is 3 in test.sh
$! The last PID that executed the instruction (the process ID number of the last process running in the background)
$- displays the current options used by shell, with the same function as the set command
$@ is similar to $*, but can be used as an array
$? The return value of the last execution instruction (shows the exit status of the last command, 0 indicates no error, and any other value indicates an error), as shown below
# result output the return value of the last command grep command grep xxx a.txtecho $? # determine whether the command to open the directory is successful. If it is not successful, output a reminder message and exit dir_exe=../croncd $dir_exeif [$?-ne 0]; then echo "cannot change dir to $dir_exe" exit 1 fi about "what is the meaning of $in linux shell" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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: 207
*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.