wangshumin@CentOSNode3 shell]$ vim shelltest4
[wangshumin@CentOSNode3 shell]$ ./shelltest4
input1:1
input2:1
sum is 2
[wangshumin@CentOSNode3 shell]$ vim shelltest4
[wangshumin@CentOSNode3 shell]$ ./shelltest4
input1:1
input2:2
sum is 3
sum is 1+2
[wangshumin@CentOSNode3 shell]$ cat shelltest4
#!/bin/bash
read -p "input1:" -t 30 num1
read -p "input2:" -t 30 num2
sum1=$(($num1+$num2))
sum2=$num1+$num2
echo "sum is $sum1"
echo "sum is $sum2"
[wangshumin@CentOSNode3 shell]$ rz
z waiting to receive.**B0100000023be50
[wangshumin@CentOSNode3 shell]$ ll
总用量 20
-rwxrw-r--. 1 wangshumin wangshumin 41 3月 10 04:37 shelltest1
-rwxr-xr-x. 1 wangshumin wangshumin 189 3月 10 05:53 shelltest2
-rwxr-xr-x. 1 wangshumin wangshumin 66 3月 10 05:57 shelltest3
-rwxrw-r--. 1 wangshumin wangshumin 151 3月 10 06:05 shelltest4
-rw-r--r--. 1 wangshumin wangshumin 188 8月 28 2013 test_rule.txt
[wangshumin@CentOSNode3 shell]$ grep -v "shen" test_rule.txt
Li Ming said:
he was the most honest man in Xiongdilian.
he never said those words.
5555
Because,actually,
Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep "shen" test_rule.txt
But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ grep -n "shen" test_rule.txt
7:But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ rz
z waiting to receive.**B0100000023be50
[wangshumin@CentOSNode3 shell]$ ll
总用量 36
-rwxrw-r--. 1 wangshumin wangshumin 41 3月 10 04:37 shelltest1
-rwxr-xr-x. 1 wangshumin wangshumin 189 3月 10 05:53 shelltest2
-rwxr-xr-x. 1 wangshumin wangshumin 66 3月 10 05:57 shelltest3
-rwxrw-r--. 1 wangshumin wangshumin 151 3月 10 06:05 shelltest4
-rw-r--r--. 1 wangshumin wangshumin 188 8月 28 2013 test_rule.txt
-rw-r--r--. 1 wangshumin wangshumin 15598 4月 12 2012 Tetris.sh
[wangshumin@CentOSNode3 shell]$ grep -n "[a-z]" test_rule.txt
1:Li Ming said:
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
15:Because,actually,
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n .grep "shen" test_rule.txt
But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$
[wangshumin@CentOSNode3 shell]$ grep -n "[^a-z]" test_rule.txt
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "[\.$]" test_rule.txt
3:he was the most honest man in Xiongdilian.
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n -v "[\.$]" test_rule.txt
1:Li Ming said:
2:
4:
5:
6:
7:But since shen Chaooo came,
8:
10:
11:5555
12:
13:
14:
15:Because,actually,
16:
[wangshumin@CentOSNode3 shell]$ grep -n "[\.$]" test_rule.txt
3:he was the most honest man in Xiongdilian.
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "^$" test_rule.txt
2:
5:
6:
8:
10:
13:
14:
16:
[wangshumin@CentOSNode3 shell]$ grep -n "oo*" test_rule.txt
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "o*" test_rule.txt
1:Li Ming said:
2:
3:he was the most honest man in Xiongdilian.
4:
5:
6:
7:But since shen Chaooo came,
8:
9:he never said those words.
10:
11:5555
12:
13:
14:
15:Because,actually,
16:
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "ooo*" test_rule.txt
7:But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ grep -n "oo*" test_rule.txt
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$
[wangshumin@CentOSNode3 shell]$ ./shelltest4
input1:1
input2:1
sum is 2
[wangshumin@CentOSNode3 shell]$ vim shelltest4
[wangshumin@CentOSNode3 shell]$ ./shelltest4
input1:1
input2:2
sum is 3
sum is 1+2
[wangshumin@CentOSNode3 shell]$ cat shelltest4
#!/bin/bash
read -p "input1:" -t 30 num1
read -p "input2:" -t 30 num2
sum1=$(($num1+$num2))
sum2=$num1+$num2
echo "sum is $sum1"
echo "sum is $sum2"
[wangshumin@CentOSNode3 shell]$ rz
z waiting to receive.**B0100000023be50
[wangshumin@CentOSNode3 shell]$ ll
总用量 20
-rwxrw-r--. 1 wangshumin wangshumin 41 3月 10 04:37 shelltest1
-rwxr-xr-x. 1 wangshumin wangshumin 189 3月 10 05:53 shelltest2
-rwxr-xr-x. 1 wangshumin wangshumin 66 3月 10 05:57 shelltest3
-rwxrw-r--. 1 wangshumin wangshumin 151 3月 10 06:05 shelltest4
-rw-r--r--. 1 wangshumin wangshumin 188 8月 28 2013 test_rule.txt
[wangshumin@CentOSNode3 shell]$ grep -v "shen" test_rule.txt
Li Ming said:
he was the most honest man in Xiongdilian.
he never said those words.
5555
Because,actually,
Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep "shen" test_rule.txt
But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ grep -n "shen" test_rule.txt
7:But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ rz
z waiting to receive.**B0100000023be50
[wangshumin@CentOSNode3 shell]$ ll
总用量 36
-rwxrw-r--. 1 wangshumin wangshumin 41 3月 10 04:37 shelltest1
-rwxr-xr-x. 1 wangshumin wangshumin 189 3月 10 05:53 shelltest2
-rwxr-xr-x. 1 wangshumin wangshumin 66 3月 10 05:57 shelltest3
-rwxrw-r--. 1 wangshumin wangshumin 151 3月 10 06:05 shelltest4
-rw-r--r--. 1 wangshumin wangshumin 188 8月 28 2013 test_rule.txt
-rw-r--r--. 1 wangshumin wangshumin 15598 4月 12 2012 Tetris.sh
[wangshumin@CentOSNode3 shell]$ grep -n "[a-z]" test_rule.txt
1:Li Ming said:
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
15:Because,actually,
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n .grep "shen" test_rule.txt
But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$
[wangshumin@CentOSNode3 shell]$ grep -n "[^a-z]" test_rule.txt
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "[\.$]" test_rule.txt
3:he was the most honest man in Xiongdilian.
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n -v "[\.$]" test_rule.txt
1:Li Ming said:
2:
4:
5:
6:
7:But since shen Chaooo came,
8:
10:
11:5555
12:
13:
14:
15:Because,actually,
16:
[wangshumin@CentOSNode3 shell]$ grep -n "[\.$]" test_rule.txt
3:he was the most honest man in Xiongdilian.
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "^$" test_rule.txt
2:
5:
6:
8:
10:
13:
14:
16:
[wangshumin@CentOSNode3 shell]$ grep -n "oo*" test_rule.txt
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "o*" test_rule.txt
1:Li Ming said:
2:
3:he was the most honest man in Xiongdilian.
4:
5:
6:
7:But since shen Chaooo came,
8:
9:he never said those words.
10:
11:5555
12:
13:
14:
15:Because,actually,
16:
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$ grep -n "ooo*" test_rule.txt
7:But since shen Chaooo came,
[wangshumin@CentOSNode3 shell]$ grep -n "oo*" test_rule.txt
3:he was the most honest man in Xiongdilian.
7:But since shen Chaooo came,
9:he never said those words.
17:Shen Chao is the most honest man.
[wangshumin@CentOSNode3 shell]$