Awk:gsub Replacement NETSTAT-TNPL | Gawk ' $NF ~/\/mongod$/{gsub (/.+:/, "", $4);p rint $4} ' |sort-n to replace all $4: End with empty shell array ${#ports [@]} #得出数组长度 ${ports[@]} = ${p Orts[*]} to derive the array value ${ports[@]:8} to get the
Programming on Linux, without the shell, plan to take a good look at Shell programming, and make notes here to share with people of the same interest, primarily in the Shell Scripting Learning Guide.Before you learn shell scripting, you need to
This is the automatic landing SSH script I wrote in St, divided into two filesFile 1:sssh#!/bin/bash#xql 2011/01/4#auto SSH 138.198.230.170Case$Inch "Xql")Sssh.exp XQL ;; "Root")Sssh.exp Root ;; "31" ) SSH [ Email protected]10. 80.117. ; "40" )
the meaning of several symbols$#: On behalf of the following parameters "number", the above table as an example of this shows as "4";[email protected]: for "$" "$" "$" "$" "$4" means, each variable is independent (enclosed in double quotation marks);
The Shell is process-oriented(Bash for example)Variables are process variables, process ends, and variables disappear.Bash Variable type:Environment variablesLocal variables (local variables):Positional variablesSpecial variablesLocal variables: Set
A shell is a program that has a special function that can be understood as an interface that users interact with the kernel. We know that the kernel is the heart of Linux, and the kernel is switched on and left in memory when it is turned on. Other
Record command history: The commands we've knocked on, Linux will have a record, saved in the. bash_history file in your home directory. (Note: The current command will be saved in the. bash_history file only if the user exits the current shell
shell script parameters can be as many as possible, but only the first 9 can be accessed, using the shift command can change this limit. The parameter starts at the first and ends at the Nineth one. $ A program name$n Nth parameter value, n=1..9$*
The bash shell itself does not support regular expressions, and the use of regular expressions is shell commands and tools such as grep, SED, awk, and so on;However, thebash shell can use some metacharacters in the regular expression to implement
At the user's point of view, there are two types of shells:log-in Shell:Log in normally via a clientSu-username or Su-l USERNAMENon-logon shell:Su USERNAMECommand window open under graphical terminalShell scripts that are executed automaticallyBash
At the user's point of view, there are two types of shells:log-in Shell:Log in normally via a clientSu-username or Su-l USERNAMENon-logon shell:Su USERNAMECommand window open under graphical terminalShell scripts that are executed automaticallyBash
Execution mode:Nohup sh export_data.sh 20150102 >20150102.log 2>&1 &[1] 295310, 1 and 2 respectively represent the following meanings:0–stdin (Standard input)1–stdout (Standard output)2–stderr (standard error)Nohup+ 's back & is to have the command
#! /bin/bash (the declaration of theLinux scripting environment is the interpreter, which is bash, under the bin directory in the root directory )Definition and assignment of variables:Format: Variable name = variable value ( No need to declare
#!/bin/bash# the script is used to configure the Nginx profile syntax highlighting # I've put Nginx.vim on my server. 172.16.0.1, you can go to the official website to download echo ' Get Nginx.vimbye ' | Lftp
IfIn the-ZTo-DThe meaning2011-09-05 10:30[-A FILE]IfFILEThe existence is true.[-B FILE]IfFILEExists and is a block special file is true.[-C FILE]IfFILEexists and is a word special file is true.[-D FILE]IfFILEexists and is a directory is true.[-E
Blog home: http://blog.csdn.net/minna_d1. Calculate the string length:echo ${#str}2. Truncate the string by character:${word:begin:length}3. With%, percent, #, # #对字符串的切割:%: Right-to-left non-greedy matchPercent: greedy match from right to left#: No
1. Calculate the length of the array:${#array [@]}2. List the array index:${!array[*]} or ${!array[@]}3. Print all the values in the array:${array[*]} or ${array[@]}Iterate through the array elements in 4.shell:For STR in ${array[@]};DoEcho
The shell executes the jar program and manually configures the JDK environment that executes the jar, executing the script as:#!/bin/shexport java_home=/home/hadoop/szw/jdk1.8.0_25 Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATHecho ' Date '
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.