I have a loop set up like the following
#!/bin/bash cat $1|while read line;do wget --limit-rate=50k http://url/$line.json -O got-$line; if [ "$?" -ne "0" ]; then rm got-$line; fi sleep 4; done
But when i call it
I get the following error
rm: cannot remove `got-inputfile.txt': No such file or directory --2012-12-30 12:18:06-- (start of wget output and everything works normal)
Like the loop is running before there is any input
Any suggestions ?