【发布时间】:2019-04-05 04:46:12
【问题描述】:
我编写了以下 bash 脚本:
#!/bin/sh
echo "Number of command line arguments : $#"
if [ $# == 0 ]; then
echo "Your command line contains no arguments"
declare -a arr=("xx.xx.xx.xx" "yy.yy.yy.yy")
else
declare -a arr=($1)
fi
for i in "${arr[@]}"
do
URL="https://"$i":8443"
echo "URL is $URL"
wget --no-check-certificate $URL/heapdump
done
第 16 行一直失败:wget: command not found
我找到了一些相关的帖子,但不知道如何解决这个问题。谢谢。
【问题讨论】:
-
在服务器中运行
wget时会输出什么? -
顺便说一句:sh 通常不是 bash。
-
为了测试,将
which wget插入到您的脚本中。