Jump to content

Two dumb scripts


justapeon

Recommended Posts

New Episode:

################################################################
# New hak5 episode?
#
file1=hak5episodes
file2=hak5episodesold
cp $file1 $file2
elinks "revision3.com/hak5/episodes" > $file1
# diff_file=diffed
# diff $file1 $file2 | grep "<" | sed 's/^<//g' > $diff_file
# cat diff_file
I=`wc -c $file1 | cut -d' ' -f1`
J=`wc -c $file2 | cut -d' ' -f1`
if [ $I -ne $J ]
then
echo new episode
echo new episode at $date > hak5lastupdate
else
echo no new episode
fi

List recent episodes:

####################################
# Latest Hak5 episodes
#
#===============================
# Assignments
# --------------------------------
datafile="hak5episodes"
a=1
flag=0
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks "revision3.com/hak5/episodes" > $datafile
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
echo $line | grep -q "All Episodes"
if [ $? -eq 0 ]; then
# header
clear
echo
echo ------------------------------------------------
echo Recent Hak5 episodes
echo ------------------------------------------------
echo ""
let "flag = 1"
fi
echo $line | grep -q "Load More"
if [ $? -eq 0 ]; then
let "flag = 0"
else
if [ $flag -eq 1 ] ; then
echo $line | sed 's/\[.*\]//' | sed 's/\Hak5//'
fi
fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===================================
# End.
####################################

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...