質問編集履歴

4

内側のダブルクオテーションをエスケープしました。

2022/12/22 02:44

投稿

kawausomaru
kawausomaru

スコア29

test CHANGED
File without changes
test CHANGED
@@ -76,3 +76,23 @@
76
76
 
77
77
  ```
78
78
  ↑実行するとこのようなメッセージが出力されました。^Cを押さないとコマンド入力できない状態です。
79
+
80
+ ```ここに言語を入力
81
+ #!/bin/bash
82
+
83
+ #ウェブフックURLを$WEBHOOKに格納
84
+ WEBHOOK="https://discord.com/api/webhooks/〇〇〇〇〇〇〇〇/〇〇〇〇〇〇〇〇"
85
+
86
+ PASS=$(df /)
87
+ curl \
88
+ -f \
89
+ -H "Content-Type: application/json" \
90
+ -d "{'content': \"$PASS\"}" \
91
+ $WEBHOOK
92
+ ```
93
+ ↑内側のダブルクオテーションをエスケープしました。
94
+ ```ここに言語を入力
95
+ curl: (22) The requested URL returned error: 400
96
+ ```
97
+ ↑こちらの行が出力されました。
98
+ curlコマンドがあるか調べたのですが/usr/bin/curlに収納されていました。

3

シングルクォーテーション→ダブルクオテーションに変更しました。

2022/12/22 02:27

投稿

kawausomaru
kawausomaru

スコア29

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,30 @@
49
49
  ```
50
50
 
51
51
  こちらの一行だけが出力されました。
52
+
53
+ ```ここに言語を入力
54
+ #!/bin/bash
55
+
56
+ #ウェブフックURLを$WEBHOOKに格納
57
+ WEBHOOK="https://discord.com/api/webhooks/〇〇〇〇〇〇〇〇/〇〇〇〇〇〇〇〇"
58
+
59
+ PASS=$(df /)
60
+ curl \
61
+ -f \
62
+ -H "Content-Type: application/json" \
63
+ -d "{'content': "$PASS"}" \
64
+ $WEBHOOK
65
+ ```
66
+ ↑シングルクォーテーション→ダブルクオテーションに変更しました。
67
+ ```ここに言語を入力
68
+ curl: (6) Could not resolve host: 1K-blocks
69
+ curl: (6) Could not resolve host: Used
70
+ curl: (6) Could not resolve host: Available
71
+ curl: (6) Could not resolve host: Use%
72
+ curl: (6) Could not resolve host: Mounted
73
+ curl: (6) Could not resolve host: on
74
+ curl: (3) URL using bad/illegal format or missing URL
75
+
76
+
77
+ ```
78
+ ↑実行するとこのようなメッセージが出力されました。^Cを押さないとコマンド入力できない状態です。

2

$PASSの引用符をシングルクォーテーションに変更しました。

2022/12/22 02:19

投稿

kawausomaru
kawausomaru

スコア29

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,25 @@
27
27
  ・引用符を様々なパターンで確認
28
28
  ・パスの中のコマンドを絶対パスで書く
29
29
  ・ただの文章が送れるか確認(送れました)
30
+
31
+ ```ここに言語を入力
32
+ #!/bin/bash
33
+
34
+ #ウェブフックURLを$WEBHOOKに格納
35
+ WEBHOOK="https://discord.com/api/webhooks/〇〇〇〇〇〇〇〇/〇〇〇〇〇〇〇〇"
36
+
37
+ PASS=$(df /)
38
+ curl \
39
+ -f \
40
+ -H "Content-Type: application/json" \
41
+ -d "{'content': '$PASS'}" \
42
+ $WEBHOOK
43
+
44
+ ```
45
+ $PASSの引用符をシングルクォーテーションに変更しました。
46
+ 変更後のエラー
47
+ ```ここに言語を入力
48
+ curl: (22) The requested URL returned error: 400
49
+ ```
50
+
51
+ こちらの一行だけが出力されました。

1

試したことを追記しました。

2022/12/22 02:10

投稿

kawausomaru
kawausomaru

スコア29

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,9 @@
21
21
  ```
22
22
  こちらのエラーが出て出力されません。
23
23
  考えられる原因などありましたら教えて頂けますと幸いです。
24
+
25
+ 試したこと
26
+ ・パスの中のコマンドを変更
27
+ ・引用符を様々なパターンで確認
28
+ ・パスの中のコマンドを絶対パスで書く
29
+ ・ただの文章が送れるか確認(送れました)