#!/bin/bash # A shell script for posting binary files to newsgroups. Written by Kim Scarborough. # Be sure to fill in the variables. # Please only post to alt.binaries.test until you're sure it's working right! POSTNAME="Your Name" POSTADDR="youraddress@wherever.com" POSTORG="Your organization" # The next line is for a temporary directory, usually /tmp. POSTTEMP="/tmp" # Put the size, in lines, you want the portions of the file to be. # Standard is around 8000, but you may want to make it smaller if your posts aren't # getting through. SEGSIZE=8000 #Leave these variables alone. FILEPFX=$RANDOM$RANDOM ORIGDIR=`pwd` XFLAG1=0 echo if [ $# = 0 ] then echo "Must specify file(s)." exit 1 fi if test ! -d $POSTTEMP then if test -f $POSTTEMP then echo "Specified temporary directory is not a directory!" if test -w $ORIGDIR then echo "Using current working directory instead." echo POSTTEMP=$ORIGDIR else echo "Aborting." exit 1 fi else if mkdir $POSTTEMP then XFLAG1=1 else echo "Specified temporary directory doesn't exist and can't be created!" if test -w $ORIGDIR then echo "Using current working directory instead." echo POSTTEMP=$ORIGDIR else echo "Aborting." exit 1 fi fi fi fi if test ! -w $POSTTEMP then echo "You don't have permission to write to the specified temporary directory!" if test -w $ORIGDIR then echo "Using current working directory instead." echo POSTTEMP=$ORIGDIR else echo "Aborting." exit 1 fi fi CA=1 TOTFIL=$# while [ $# -gt 0 ] do if test -f $1 then CP=1 echo  echo $1 "(File" $CA "of" $TOTFIL")" echo echo -n "Newsgroup(s): " read NG echo -n "Subject: " read SUB echo "Now uuencoding" $1"." uuencode $1 $1 > $POSTTEMP/$1.uue cd $POSTTEMP echo "Uuencoding done. Now splitting" $1".uue." split -l $SEGSIZE $1.uue $FILEPFX rm $1.uue echo `ls $FILEPFX* | wc -l` > pxtempzz TP=`sed 's/ //g' pxtempzz` rm pxtempzz echo $1".uue split into" $TP "pieces." for FIL in $FILEPFX* do echo "Now posting" $CP "of" $TP inews -S -f "$POSTNAME <$POSTADDR>" -n "$NG" -o "$POSTORG" -t "$SUB ($CP/$TP)" < $FIL let CP=$CP+1 done echo "Posting done." rm $FILEPFX* let CA=$CA+1 cd $ORIGDIR else echo $1 "doesn't exist!" let TOTFIL=$TOTFIL-1 fi shift done if [ $XFLAG1 = 1 ] then rm -rf $POSTTEMP fi echo  echo "Posting of all files completed." echo