In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "what are the parameters of Shell", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the parameters of Shell" this article.
Shell parameter
Pass parameters: you can pass external values to the internal functions of the script to improve the flexibility of the script; you can add options for the use of the script to increase the customization of the script.
The figure above shows the parameter passing of the function in Shell: define the function testfunc (); the function outputs two reference parameters, $# indicates the number of parameters passed into the function, and $@ represents the contents of all parameters.
It is worth noting that if you have more than 9 parameters, you cannot use $10 to reference the tenth parameter. You must first process or save the first parameter ($1), then use the shift command to delete the first parameter and move the remaining parameters up one bit, then $10 becomes $9, and so on, and the value of $# will be updated to reflect the number of remaining parameters. In practice, the iterative method is generally used to complete this constraint.
Many UNIX programs follow the principle of reading from standard input (standard input), processing, output from standard output (standard output), and reporting exceptions and errors to standard error (standard error). Such a program is called a filter.
The redirect symbol command > filename redirects the standard output of command to filename instead of printing it on the console. If there is a filename of the same name, overwrite it, if not, create a new one; command > > filename redirects the standard output of command to filename as an append, and does not overwrite the file of the same name; command means redirect standard output, 2 > means redirect standard error, 0
< 表示重定向标准输入,&>Represents redirected standard output and standard error. A file descriptor is a handle represented by an unsigned integer that is used by the process to identify an open file and is associated with a file object that includes relevant information, such as the file's opening mode, the file's location type, the file's initial type, and so on. this information is called the context of the file.
Special file: / dev/null is very close to a write-only file, everything written to it is lost forever, and the result of reading it is a null value, usually used to redirect standard output or standard error, or to empty the contents of a file without changing file permissions. / dev/zero produces a null stream (binary zero stream, not ASCII type), which is mainly used to create a file of a specified length and initialized to empty, typically used as a temporary exchange file.
Common Linux file types
Normal file: a file that uses ls-lh to view the properties of a file with the first character -. It is generally created with some related applications and deleted with the rm command.
Directory: the first file with the character d. You can use the mkdir or cp command to create a directory and delete it with rm or rmdir.
Character device or block device file: the first character is c for character device file and b for block device. Create with mknode and delete with rm. But they are generally created involuntarily, and they are associated with the kernel.
Socket file: the first file with the character s.
Symbolic link file: the first file whose character is l. Created with the command "ln-s source file name new file name". Similar to shortcuts in windows systems.
These are all the contents of the article "what are the parameters of Shell". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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.