回答編集履歴
3
Bashでない場合
test
CHANGED
@@ -31,3 +31,29 @@
|
|
31
31
|
fi
|
32
32
|
|
33
33
|
```
|
34
|
+
|
35
|
+
### 追記:Bashでない場合
|
36
|
+
|
37
|
+
```Bash
|
38
|
+
|
39
|
+
#!/bin/sh
|
40
|
+
|
41
|
+
hoge='OK'
|
42
|
+
|
43
|
+
case "$hoge" in
|
44
|
+
|
45
|
+
*"OK"*)
|
46
|
+
|
47
|
+
echo "good"
|
48
|
+
|
49
|
+
;;
|
50
|
+
|
51
|
+
*)
|
52
|
+
|
53
|
+
echo "bad"
|
54
|
+
|
55
|
+
;;
|
56
|
+
|
57
|
+
esac
|
58
|
+
|
59
|
+
```
|
2
修正
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
```Bash
|
18
18
|
|
19
|
-
#!/bin/sh
|
19
|
+
#!/bin/bash
|
20
20
|
|
21
21
|
hoge='OK'
|
22
22
|
|
1
追記
test
CHANGED
@@ -13,3 +13,21 @@
|
|
13
13
|
fi
|
14
14
|
|
15
15
|
```
|
16
|
+
|
17
|
+
```Bash
|
18
|
+
|
19
|
+
#!/bin/sh
|
20
|
+
|
21
|
+
hoge='OK'
|
22
|
+
|
23
|
+
if [[ $hoge == *"OK"* ]]; then
|
24
|
+
|
25
|
+
echo "good"
|
26
|
+
|
27
|
+
else
|
28
|
+
|
29
|
+
echo "bad"
|
30
|
+
|
31
|
+
fi
|
32
|
+
|
33
|
+
```
|