创建10个文件并写入内容
# 执行效果
root in jCeXjfniZtN in /
➜ mkdir test10
root in jCeXjfniZtN in /
➜ cd test10/
root in jCeXjfniZtN in /test10
➜ vim test.sh
root in jCeXjfniZtN in /test10 took 5s
➜ cat test.sh
#!/bin/bash
for ((i=1; i<11; i++));
do
touch test$i.txt
done
for file in test1.txt test2.txt test3.txt test4.txt test5.txt test6.txt test7.txt test8.txt test9.txt test10.txt
do
echo -e "11 22\n11 22\n11 22\n11 22\n11 22\n11 22\n11 22\n11 22\n11 22\n11 22" >> $file
done
root in jCeXjfniZtN in /test10
➜ ll
total 4
-rw-r--r-- 1 root root 304 Dec 9 14:40 test.sh
root in jCeXjfniZtN in /test10
➜ sh test.sh
root in jCeXjfniZtN in /test10
➜ ll
total 44
-rw-r--r-- 1 root root 60 Dec 9 14:40 test10.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test1.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test2.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test3.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test4.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test5.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test6.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test7.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test8.txt
-rw-r--r-- 1 root root 60 Dec 9 14:40 test9.txt
-rw-r--r-- 1 root root 304 Dec 9 14:40 test.sh
root in jCeXjfniZtN in /test10
➜ cat test10.txt
11 22
11 22
11 22
11 22
11 22
11 22
11 22
11 22
11 22
11 22
root in jCeXjfniZtN in /test10
➜
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
上次更新: 12/9/2021, 3:29:51 PM