LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-30-2015, 10:59 PM   #1
bbmak
Member
 
Registered: May 2004
Posts: 178

Rep: Reputation: 31
Bash Script: Illegal number


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
 
Old 05-01-2015, 01:21 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Run the script as you usually would but use the BASH switches "-vx", catch both stdout / stderr and look at the output. If unsure post your full command line and output here between vBB code tags.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script number formatting mijohnst Programming 10 07-27-2012 12:33 AM
[SOLVED] Bash script - number testing issue ravedog Linux - Newbie 10 12-31-2011 11:13 AM
Bash:Printing the line number in bash script suryaemlinux Programming 2 02-05-2011 09:59 AM
Bash script question - formatting a number HarryBoy Linux - Newbie 10 08-31-2010 10:07 PM
bash script to download a number of things linksocc Linux - Software 3 12-10-2003 12:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration