#!/bin/bash   
   # text2bbbs.sh   
   # Copyright 2011 Robert James Clay , GPL2+   
   # Import a text file into BBBS message conference   
   #   
   BBBSDIR=/opt/bbbs   
   MINPARAMS=2   
      
   print-usage ()   
   {   
    echo   
    echo "Usage: text2bbbs.sh ConfName TextFile [SubjFile] [FromFile]   
   [ToFile]"   
    echo "ConfName: Name of the message conference to be posted to."   
    echo "TextFile: Path and file name to be posted to the conference."   
    echo "[SubjFile]: Path and file name containing the subject. Defaults to   
   the name of the file."   
    echo "[FromFile]: Path and file name containing the From. Defaults to   
   Sysop."   
    echo "[ToFile]: Path and file name containing who it's to be posted to.   
   Defaults to All. "   
   }   
      
   if [ $# -lt "$MINPARAMS" ]   
   then   
    echo   
    echo "This script requires at least $MINPARAMS command line parameters."   
    print-usage   
    exit 1   
   fi   
      
   # BBBS Message conference parameter   
   if [ -n "$1" ]   
   then   
    CONFERENCE=$1   
   fi   
      
   # Path and file name to be posted   
   if [ -n "$2" ]   
   then   
    TEXTFILE=$2   
   fi   
      
   # Define Subject for message to be posted   
   if [ -n "$3" ]   
   then   
    OPTIONS=" /S "   
    SUBJECT+=`cat $3`   
   else   
    OPTIONS=" /S "   
    SUBJECT+=`basename $3`   
   fi   
      
   OPTIONS=""   
      
   # Define From parameter, if present   
   if [ -n "$4" ]   
   then   
    OPTIONS+=" /F "   
    OPTIONS+=`cat $4`   
   fi   
      
   # Define To parameter, if present   
   if [ -n "$5" ]   
   then   
    OPTIONS+=" /T "   
    OPTIONS+=`cat $5`   
   fi   
      
      
   cd $BBBSDIR   
      
   # defaults: sysop,All, filename   
   # btxt2bbs [areaname] [file] {/F from} {/T to} {/S subject }   
   #   
   $BBBSDIR/bbbs btxt2bbs $CONFERENCE $TEXTFILE /S $SUBJECT $OPTIONS   
      
   exit 0   
      
   --- BBBS/LiI v4.01 Flag   
    * Origin: Rocasa BBS (1:120/546)   
|