回答編集履歴
2
回答修正: curlコマンドの-sまで消してしまったのを復活
answer
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
以下で最終行にhttp statusが付与されます。
|
4
4
|
|
5
5
|
```bash
|
6
|
-
res=`curl -L google.com -w '\n%{http_code}'`
|
6
|
+
res=`curl -L google.com -w '\n%{http_code}' -s`
|
7
7
|
body=`echo "$res" | sed '$d'`
|
8
8
|
httpstatus=`echo "$res" | tail -n 1`
|
9
9
|
```
|
1
回答修正: curlコマンドのオプションが冗長だったので修正
answer
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
以下で最終行にhttp statusが付与されます。
|
4
4
|
|
5
5
|
```bash
|
6
|
-
res=`curl -L google.com -
|
6
|
+
res=`curl -L google.com -w '\n%{http_code}'`
|
7
7
|
body=`echo "$res" | sed '$d'`
|
8
8
|
httpstatus=`echo "$res" | tail -n 1`
|
9
9
|
```
|