Table of contents
One, $#
$#: Indicates the number of parameters passed to the script.
$1: Indicates the first parameter passed to the script. $0 is the script itself
Two, -ne
-ne: Check whether two numbers are not equal, and return True if they are not equal
#! /bin/bash
num1=1
num2=2
if [ $num1 -ne $num2 ];then
echo "$num1 和 $num2 不相等"
else
echo "$num1 和 $num2 相等"
fi
3. NR
NR: is the total number of lines read
Four, $$
$$ will get the current process ID number of the script running
Five, lt
-lt | Checks if the number on the left is less than the number on the right, and if so, returns true. |
Six, $@
list of all parameters
Screenplay:
#!/bin/bash
echo "所有的参数列表:$@"
run:
Seven, ${a[@]}
Get all elements in the array
8. ${#a[*]}
Get the number of arrays. a is the array name.
code:
operation result: