質問編集履歴
2
シェルの内容修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
if [ $line == "bash
|
33
|
+
if [ `echo $line | awk '{print $1}' ` == "bash" ];then
|
34
34
|
|
35
35
|
eval "$line"
|
36
36
|
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
-
done < test.
|
47
|
+
done < test.txt
|
48
48
|
|
49
49
|
```
|
50
50
|
|
@@ -54,25 +54,17 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
-
//ccccccの行数取得
|
58
|
-
|
59
|
-
LINE=`grep -n "cccccc" test.txt | awk '{print $1}' | sed s/[^0-9]//g
|
57
|
+
LINE=`grep -n "cccccc" test.txt | awk '{print $1}' | sed s/[^0-9]//g`
|
60
58
|
|
61
59
|
|
62
60
|
|
63
|
-
//取得した行削除
|
64
|
-
|
65
|
-
sed -i "$LINEd" test.txt
|
61
|
+
sed -i "${LINE}d" test.txt
|
66
62
|
|
67
63
|
|
68
|
-
|
69
|
-
//test.txtの内容確認
|
70
64
|
|
71
65
|
TEST=$(<test.txt)
|
72
66
|
|
73
67
|
echo $TEST
|
74
|
-
|
75
|
-
echo ""
|
76
68
|
|
77
69
|
|
78
70
|
|
@@ -108,28 +100,16 @@
|
|
108
100
|
|
109
101
|
■実行結果
|
110
102
|
|
111
|
-
//ChangeFile.shでの出力結果
|
112
|
-
|
113
103
|
aaaaaa
|
114
104
|
|
115
105
|
bbbbbb
|
116
106
|
|
117
|
-
bash ChangeFile.sh
|
107
|
+
aaaaaa bbbbbb bash ChangeFile.sh dddddd
|
118
|
-
|
119
|
-
cddddd
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
//main.shでの出力結果
|
124
|
-
|
125
|
-
aaaaaa
|
126
|
-
|
127
|
-
bbbbbb
|
128
108
|
|
129
109
|
cccccc
|
130
110
|
|
131
|
-
|
111
|
+
dddddd
|
132
112
|
|
133
113
|
```
|
134
114
|
|
135
|
-
|
115
|
+
「cccccc」が出力されないようにしたいです。
|
1
誤記の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,10 +27,6 @@
|
|
27
27
|
while read line
|
28
28
|
|
29
29
|
do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
bash ChangeFile.sh
|
34
30
|
|
35
31
|
|
36
32
|
|