links to Commands1. Piping2.Xargs-commonly used as stdin:Find/etc-name c*.conf |Xargs Tar-czf/tmp/test.tgz3.-the use of the minus sign: The standard output of the former as the latter's standard input. Typically used in tarTar-CZF-Home |Tar-XZF-C/tmp Advantage: For large files in-machine transmission, faster than CP, high efficiency.4; Execute multiple commands sequentially CMD1&&CMD2 If the previous command (CMD1) is executed correctly, execute the latter command (CMD2) CMD1||CMD2 If the previous command (CMD1) is executed correctly, the latter command (CMD2) is not executed, and the latter command (CMD2) is executed if the previous command (CMD1) executes an error. Positional parameters $1represents the first parameter of the input $2represents the second parameter of the input .... $0represents the Bash program itself name $# represents the number of parametersShiftRepresents the removal of the first position parameter, which is shifted forward by one bit by the subsequent position parameter.
array:1. A collection of a series of variables of the same type. can be a string or a number2. Settings and references the first way to set up: references: [[email protected]~]# a[0]=1 Echo${a[0]} [[email protected]~]# a[1]=2[[Email protected]~]# a[2]=3Subscript starting from 0, 0 represents the first second setting: [[email protected]~]# b=(a b c) [[email protected]~]#Echo${b[0]}a[[email protected]~]#Echo${b[1]}b[[email protected]~]#Echo${b[2]}c[[email protected]~]# b= (a B c [ -]=carol)--You can skip a few elements directly to the 51 assignment [[email protected]~]#Echo${b[ -]}carol Remove all elements from the array [[email protected]~]#Echo${b[@]}a B c carol[[email protected]~]#Echo${b[*]}a b c carol[[email protected]~]# a= (1 2 3 4[Ten]=a B) [[Email protected]~]#Echo${a[ One]}b[[email protected]~]#Echo${a[Ten]}a[[email protected]~]# a= (1 2 3 4[Ten]='a B') [[email protected]~]#Echo${a[Ten]}[[email protected]~]# forIinch "${a[*]}"; Do Echo$i; Done1 2 3 4a bcd[[email protected]~]# forIinch "${a[@]}"; Do Echo$i; Done1234A-B double quotation marks represent the value of the source format that exactly follows the array.*represents a fetch of all values at once, @ represents the value in turn #!/bin/bash--the code that loops through the row assignment. Num=1 whileRead Line Doa[$num]=$LINE Num=$ (($num +1)) Done</etc/passwdEcho${a[ -]}~title: There is a numlist, a total of four columns, asking for the maximum number of each row. Numlist1 3 5 24 3 2 73 0 9 5empty the array value empty single value: unset a[0] Empty the entire array: unset A
0 Basic Learning Cloud computing and Big Data DBA cluster Architect "Linux Bash shell Programming and system Automation January 12, 2015 Tuesday"