本来有找到一个写法:
#!/bin/bash
#CONFFILE 更改成你的conf文件真实地址
CONFFILE="xxx/qBittorrent.conf"
#DOCKERID 更改成你的Docker容器ID 在SSH使用docker ps命令查看ID
DOCKERID="xxx"
list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt|awk NF|sed ":a;N;s/\n/,/g;ta"`
if [ -z "`grep "TrackersList" $CONFFILE`" ]; then
sed -i '$a TrackersList='${list} $CONFFILE
echo add......
else
sed -i "s@TrackersList.*@TrackersList=$list@g" $CONFFILE
echo update......
fi
得到的是并不适用于qb要求的结果:
Bittorrent\TrackersList=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.open-internet.nl:6969/announce,udp://tracker.leechers-paradise.org:6969/announce,udp://tracker.internetwarriors.net:1337/announce,udp://tracker.opentrackr.org:1337/announce,udp://9.rarbg.to:2710/announce,udp://9.rarbg.me:2710/announce,udp://tracker.openbittorrent.com:80/announce,udp://exodus.desync.com:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://retracker.lanta-net.ru:2710/announce,udp://tracker.tiny-vps.com:6969/announce,udp://open.demonii.si:1337/announce,udp://bt.xxx-tracker.com:2710/announce,udp://tracker.cyberia.is:6969/announce,udp://thetracker.org:80/announce,udp://denis.stalker.upeer.me:6969/announce,udp://explodie.org:6969/announce,http://open.acgnxtracker.com:80/announce,udp://open.stealth.si:80/announce
需要得到的结果是:(其实就是需要将 “ , ” 改为 “ \n ”)
Bittorrent\TrackersList=udp://tracker.coppersurfer.tk:6969/announce\nudp://tracker.open-internet.nl:6969/announce\nudp://tracker.leechers-paradise.org:6969/announce\nudp://tracker.internetwarriors.net:1337/announce\nudp://tracker.opentrackr.org:1337/announce\nudp://9.rarbg.to:2710/announce\nudp://9.rarbg.me:2710/announce\nudp://tracker.openbittorrent.com:80/announce\nudp://exodus.desync.com:6969/announce\nudp://tracker.torrent.eu.org:451/announce\nudp://retracker.lanta-net.ru:2710/announce\nudp://tracker.tiny-vps.com:6969/announce\nudp://open.demonii.si:1337/announce\nudp://bt.xxx-tracker.com:2710/announce\nudp://tracker.cyberia.is:6969/announce\nudp://thetracker.org:80/announc\nudp://denis.stalker.upeer.me:6969/announce\nudp://explodie.org:6969/announce\nhttp://open.acgnxtracker.com:80/announce\nudp://open.stealth.si:80/announce
求救各位大神要怎么修该一下原写法…T_T 小白流下了不懂代码的泪