teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追記

2019/01/11 01:14

投稿

moonphase
moonphase

スコア6621

answer CHANGED
@@ -44,4 +44,28 @@
44
44
  if [ "${_RESULT}" == "00" ];then
45
45
 
46
46
  if [ "${_RESULT}" = "00" ];then
47
- ```
47
+ ```
48
+
49
+ # 追記19011
50
+
51
+ ## if構文エラーについて
52
+
53
+ 以下は構文間違えています。必ずTrueになります。
54
+ やりたいことは_RESULT_1と_RESULT_2が共に0であることですか?
55
+
56
+ ```
57
+ if [ _RESULT_1=0,_RESULT_2=0 ];then
58
+
59
+ if [ "${_RESULT_1}${_RESULT_2}" = "00" ];then
60
+ ```
61
+
62
+ AWS関係なく、まずはシェルのif構文について正確に理解してください。
63
+
64
+ ## aws: error: argument --volume-id: expected one argumentについて
65
+
66
+ `--volume-id`に複数のパラメータを渡しているのでしょう。
67
+ 何が渡されているか`set x`や`echo`などで確認してください。
68
+
69
+ ## Waiter VolumeInUse failed: Max attempts exceededについて
70
+
71
+ このエラーが出た場合は再度コマンドを実行します。

2

追記2

2019/01/11 01:14

投稿

moonphase
moonphase

スコア6621

answer CHANGED
@@ -37,4 +37,11 @@
37
37
  if [ $? -eq 0 ]; then
38
38
  echo "スナップショットの作成が完了しました."
39
39
  fi
40
+ ```
41
+
42
+ 文字列の比較は`=`です。
43
+ ```
44
+ if [ "${_RESULT}" == "00" ];then
45
+
46
+ if [ "${_RESULT}" = "00" ];then
40
47
  ```

1

回答追記

2019/01/09 14:30

投稿

moonphase
moonphase

スコア6621

answer CHANGED
@@ -24,4 +24,17 @@
24
24
 
25
25
  if [ -f tmp/snapshot_ids -a $(cat tmp/snapshot_ids | wc -l) = "2" ];then
26
26
 
27
+ ```
28
+
29
+ # 以下追記
30
+
31
+ 数値の判定は`-eq`です
32
+ ```
33
+ if [ $? == 0 ]; then
34
+ echo "スナップショットの作成が完了しました."
35
+ fi
36
+
37
+ if [ $? -eq 0 ]; then
38
+ echo "スナップショットの作成が完了しました."
39
+ fi
27
40
  ```