I try to make a script for the transmission-remote. The script will start the torrent that higher or equal than the threshold percentage. However, I got an Illegal number. Anybody knows how to fix this?
Code:
#!/bin/sh
SERVER="-n username:password"
THRESHOLD="95"
# use transmission-remote to get torrent list from transmission-remote list
TORRENTLIST=$(transmission-remote $SERVER --list | awk '{print $1}' | grep '[0-9]')
for TORRENTID in $TORRENTLIST
do
PERCENTAGE=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: " | sed -e"s/Percent Done: //g" | sed "s/%//g"`
echo $PERCENTAGE
if [ "$PERCENTAGE" -gt "$THRESHOLD" ] ; then
transmission-remote $SERVER $TORRENTID --start
echo "$TORRENTLIST"
echo "$PERCENTAGE"
fi
done