Shell Basics1. What is a shellShell is a program developed by C language he is a bridge for users to use Linuxis both a command languageAn application This application provides an interface through which users access the operating system kernel's
Different shells have different functions, the shell also decided that the default shell in Linux is/bin/bash, the popular shell has ash, bash, Ksh, CSH, zsh, and so on, different shells have their own characteristics and use.BashThe Shell,bash
#通配符 {} * []?1.1 The difference between quotation marks and unquoted 1:[[email protected] ~]# touch a B[email protected] ~]# LLTotal 0-rw-r--r--. 1 root root 0 June 16:25 a-rw-r--r--. 1 root root 0 June 16:25 b[[email protected] ~]# touch "a
Click Back to learn the path of the Linux command line and shell script5.1-shell Parent-child relationship1 common types of shells
Bash is the Linux standard default Shell, which is an abbreviation for the Bunrneagain shell, with a total of
1. basic usage of shell variables and usage of common symbolsThis section requires writing out the shell commands that implement the requirements, showing(1) Change the main prompt to the user's home directory name(2) Assign the string DOS file c:>\
Find./-mtime 18-exec ls-l {} \;Special places in this example are {} and \; And the-exec keyword, the meaning of these things:
{} stands for "content found by find" and, as shown, the result of find is placed in the {} position;
-exec
Shell Script Learning (i)A) Introduction to code-style shell scripts 1. Download Xshell 5 Build a folder Mkdri Home/data;1) Look at a 1.sh built in data See if the build was successful.2) and edit echo Hello Word, and save the launch
#!/bin/bashWhile:Doecho "1. View CPU
View Memory
View Disk
View IP
Exit
Read-p "Please select menu:" ItemIf [${item}-eq 1]; Thenecho "CPU operating frequency is as follows:"Cat/proc/cpuinfo | grep MHRead-p "Enter carriage
Basic composition:find pathname-option [-print-exec-ok ...]Classify the attributes of the memory parameters ~Pathname: Specifies the query root path of the find command, such as '/', './'.You can also specify the search path in the-path
declaring functionsDemofun () { echo" This is my first shell function! " }Function name () {... function body}In the shell, arguments can be passed to a function when it is called. Inside the function body, the value of the parameter is obtained
Create a script admin.shPerform the following functions:-H | --HELP: Providing Help information--add users: Completing user additions-del User | --delete: Complete User deletion-V: Turn on debug mode, display informationYou can use all of the above
read:Brief introduction:The read command reads the value of a variable from the keyboard and is typically used in a shell script to interact with the user. The command can read the values of multiple variables at once, and the variables and input
Integer numeric Operations use the expr command: You can only do integer operations and return the calculation results by default Format:Expr integer 1 operator integer 2 ...Integer values can be supplied with variables, giving the result of the
Function Description: Execute commands on multiple servers in bulk1 #!/bin/bash2 3 # ==========================================4 #function: Execute commands on multiple servers in bulk5 #method:./batch_cmd_manager.sh 6 #return: List of results
Function Description: Cleans the Messages history log file (Messages-date) under the/var/log/path, but does not clean the messages file itselfDependency requirements: The BC module is installed on the server1 #clean_logs.sh2 #!/bin/bash3 4 # ========
Array:Variables: Storing the memory space of a single elementArray: A contiguous memory space that stores multiple elements, equivalent to a collection of multiple variablesArray name and IndexIndex: Numbering starting from 0, which is a numeric
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.