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.
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
run "C:\Web Browser.exe" $goalURL