|  | 
 
| #! /bin/bash # $0:slrn_config.sh
 # purpose:slrn setup script,  [email protected]
 RC="$HOME/.slrnrc"
 MYFILE="$HOME/.bash_profile"
 JRC="$HOME/.jnewsrc"
 
 # is slrn installed?
 
 which slrn > /dev/null 2>&1 ; RET=$? ; if [ "$RET" != "0" ]
 then echo "No slrn was found." ; exit $RET ;fi
 
 # .bash_profile editing
 cp -f $MYFILE ${MYFILE}.backup
 grep -w 'NNTPSERVER' $MYFILE > /dev/null 2>&1 ; RETone=$?
 if [ "$RETone" != "0" ] ; then
 echo "News server is  not set , I make a free one."
 echo 'export NNTPSERVER="freenews.netfront.net"' >> $MYFILE
 fi
 
 # is there a .jnewsrc file in home?
 if [ -e "$HOME/.newsrc" ] ; then
 cp $HOME/.newsrc $JRC
 fi
 if [ ! -e "$JRC" ] ; then
 MYLANG=`env | grep LANG | cut -d '=' -f2`
 case "$MYLANG" in
 zh_HK* | zh_TW*) echo 'tw.bbs.comp.linux:' > $JRC
 echo 'tw.bbs.comp.mswindows:' >> $JRC
 echo 'comp.unix.shell:' >> $JRC
 ;;
 zh_CN*) echo 'cn.bbs.comp.linux:' > $JRC
 echo 'cn.bbs.comp.mswindows:' >> $JRC
 echo 'comp.unix.shell:' >> $JRC                                                 ;;
 *) echo 'comp.unix.shell:' > $JRC
 ;;
 esac
 fi
 
 # to make a .slrnrc file
 echo "Some setting for slrn"
 echo -n "Username? [default:$(whoami)]" ; read a
 [ -z "$a" ] && a=$(whoami)
 echo "set username \"$a\""  > $RC
 echo -n "hostname? [default:invalid.net]" ; read b
 [ -z "$b" ] && b='invalid.net'
 echo "set hostname \"$b\"">> $RC
 echo -n "replyto? [default:$(whoami)@invalid.net]" ; read c
 [ -z "$c" ] && c=$(whoami)@invalid.net
 echo "set replyto \"$c\""  >> $RC
 echo -n "organization? " ; read d
 [ -z "$d" ] && d=--
 echo "set organization \"$d\""  >> $RC
 echo -n "Do you want a signature? [y/n]" ; read yesno
 case "$yesno" in
 [y|Y]) echo "$HOME/.signature is your signature file,you may edit it."
 echo "set signature \".signature\"" >> $RC
 ;;
 *) echo "set signature \"\"" >> $RC
 ;;
 esac
 echo 'set server_object "nntp"' >> $RC
 echo 'set post_object "nntp"' >> $RC
 echo -n 'Would you like to make directory to save posts? [y/n] '
 read ans
 if [ "x${ans}" = "xy" ] ; then
 echo 'set save_posts "News/My_Posts"' >> $RC
 echo 'Save posts at News/My_Posts'
 fi
 echo -n "Would you like to make directory to save replies? [y/n] "
 read reply
 if [ "x${reply}" = "xy" ] ; then
 echo 'set save_replies "News/My_Replies"' >> $RC
 echo 'Save replies at Mews/My_Replies'
 fi
 echo 'set save_directory "News"' >> $RC
 echo 'set mime_charset "iso-8859-1"' >> $RC
 echo 'compatible_charsets "Big5,gb2312"' >> $RC
 echo 'set sorting_method 11' >> $RC
 sed -n '/^[^%]/p' /etc/slrn.rc >> $RC
 
 # summary and need to exec some command
 echo ""
 echo "---------read this-----------------------------------------"
 echo ""
 echo "Conglautions. setup is completed."
 echo "you may make environment variable effected,"
 echo "type source .bash_profile in $HOME directory"
 echo "Running gnome-terminal , type slrn."
 echo "Running in console mode , type zhcon into chinese terminal,"
 echo "then type slrn"
 echo "have fun."
 echo ""
 echo "---------End here-------------------------------------------"
 | 
 |