Register
It is currently Sun Nov 23, 2014 10:06 am

I would love to see a shortened and faster version of this


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Thu Nov 27, 2008 2:02 am   

Joined: Sat Oct 11, 2008 9:46 am
Posts: 2
Hi there - I have a script here that I use to automatically open up new threads for me on a web forum so that I don't miss a new post in the short time that I have to reply to those threads when they go live. This does the job for me but I have a feeling this can be simplified and improved bigtime. I'm really hoping somebody can open this thread up and look at this code and say "oh yeah, here's a much better and faster way" because I feel like a lot of this can be cut down and simplified. I just don't know how to get it any better than this because I'm new to the world of Bash. This alone took me a whole day to put together how I wanted it to work.

Any help would be greatly appreciated.

Code:
while : ; do
cat l2 > xxxa
   if cat xxxa | grep "Unread" > xxxb ; then
      cat xxxb | cut -c36-37 | head -n1 > xxxc         #cuts number of link
      sed 's/$/\. /' xxxc > xxxd                               #adds . after number
      sed 's/^/\  /' xxxd > xxxe                              #adds spaces in front
cat xxxa | grep -B 1 "--file=xxxe" | cut -c1-300 | head -n1 > xxxf   #line that contains goal
cat xxxf | wc -c > xxxg                                         #count characters in URL line
    lastn=`cat xxxg`                                              #change xxxg to $lastn
    lastn=`expr $lastn - 1`                                     #subtract 1 from $lastn
    firstn=`expr $lastn - 6`                                    #subtract 6 = 1st digit
    cat xxxf | cut -c$firstn-$lastn > goal                  #cut the 7 digit goal
    sed 's/^/http:\/\/www.url.com/' goal > goal2
      goalURL=`cat goal2`
      run "C:\Web Browser.exe" $goalURL
      sleep 15s
   fi
sleep 0.18s
done


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP