在 shell 脚本中使用 curl 时,如何消除所有额外的文本?

Rya*_*yan 3 bash shell curl

这是一个示例 ip 代理检查器 shell 脚本:

#!/bin/sh
while read IP
do
    CURL=$(curl -x http://$IP -L http://icanhazip.com)
    echo "$CURL"
done < ip.txt
Run Code Online (Sandbox Code Playgroud)

但不是像这样的简单结果:

0.0.0.0
1.1.1.1
Run Code Online (Sandbox Code Playgroud)

我得到:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
0.0.0.0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
1.1.1.1
Run Code Online (Sandbox Code Playgroud)

我怎样才能让多余的东西安静下来?

Rya*_*yan 6

-s/--silent

静音模式。不要显示进度表或错误消息。使 Curl 静音。如果此选项使用两次,第二个将再次禁用静音。

CURL=$(curl -s -x http://$IP -L http://icanhazip.com)
Run Code Online (Sandbox Code Playgroud)