解决-bash: jq: 未找到命令 的问题
前言
今天在某个TikTok群里,然后有个热心网友发布了某个脚本,在某些VPS里面能运行,某些VPS里面又无法运行!
因此本文就来了
检测当前TikTok所属国区
脚本
curl -s https://raw.githubusercontent.com/PYniang/Tiktokregion/main/t.sh | bash
脚本内容
if [ ! "$(command -v jq)" ]; then
apt install jq -y
yum install jq -y
fi
if [ ! "$(command -v curl)" ]; then
apt install curl -y
yum install curl -y
fi
clear
region=$(curl -s https://www.tiktok.com/node/common/web-privacy-config?locale=zh-Hant-TW | jq '.body.appProps.region')
echo "地区:"$region
从内容中可以看到,他是访问https://www.tiktok.com/node/common/web-privacy-config?locale=zh-Hant-TW
来获取appProps
的值,是用jq来解析的!
一般情况,运行会没问题,在部分VPS会遇到如下问题
bash:行10: jq: 未找到命令
那么这是啥问题呢,很简单jq没有或太老呗!
有人说,那简单的一笔
yum -y install jp
搞定,那只是部分了拉!
看我的
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
cp jq /usr/bin
然后在跑脚本就行了拉!
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »