|
作者:sslihong |
|
#### 查看通知内容 #### more_TONGZHI() { clear echo "浏览时按空格键往后翻页,按回车键换行,按"del"键可中止浏览!\n" echo "按回车键开始显示通知内容!\c" read wait more $FILE if [ $? -eq 0 ] then echo "显示完成!按回车键继续!\c" read wait else echo "显示失败!按回车键继续!\c" read wait fi }
#### 打印通知内容 #### print_TONGZHI() { while true do echo "\n\n" echo "\t\t <1> 主机打印 " echo "\t\t <2> 终端打印 " echo "\t\t <3> 不打印,退出 \n" echo "\t\t请选择打印方式: \c" read sel rest [ "$sel" ] || continue sel_long=`expr length $sel` [ $sel_long -eq 1 ] || continue [ $sel -ge 1 -a $sel -le 2 ] && break [ $sel -eq 3 ] && { echo "\n\n\t\t您选择了不打印!按回车键退出!\c" read wait return 1 } done
case $sel in 1) echo "\n\n主机打印.......\c" lp $FILE >/dev/null if [ $? -eq 0 ] then echo "\033[2;14;1m完成!\033[2;7;0m按回车键继续!\c" [ -f /usr/dzhd/tmp2/NOTICE ] && mv /usr/dzhd/tmp2/NOTICE /usr/dzhd/tmp2/NOTICE.OLD read wait else echo "\033[2;14;4m失败!\033[2;7;0m按回车键继续!\c" read wait fi return 1 ; 2) echo "\n\n终端打印.......\c" echo "[2h[5i" >/tmp/ttylptmp.txt cat $FILE >>/tmp/ttylptmp.txt echo "[4i[2l" >>/tmp/ttylptmp.txt cat /tmp/ttylptmp.txt if [ $? -eq 0 ] then echo "完成!按回车键继续!\c" [ -f /usr/dzhd/tmp2/NOTICE ] && mv /usr/dzhd/tmp2/NOTICE /usr/dzhd/tmp2/NOTICE.OLD read wait else echo "失败!按回车键继续!\c" read wait fi return 1 esac }
###### 检测文件程序 ###### check_file() { [ -f /usr/dzhd/tmp2/NOTICE ] || { echo "\n\n\t\t没有最新通知,您是否要查看或打印旧通知?(Y/N或y/n)\c" read key [ "X$key" != "Xy" -a "X$key" != "XY" ] && { echo "\n\n\t\t您选择了 N(n) !按回车键将退出!\c" read wait exit } [ -f /usr/dzhd/tmp2/NOTICE.OLD ] || { echo "\n\n\t\t对不起!既没有新通知也没有旧通知,按回车键退出。\c" read wait exit } FILE=/usr/dzhd/tmp2/NOTICE.OLD return 1 } FILE=/usr/dzhd/tmp2/NOTICE }
##### 主程序:用于查看和打印联行系统通知,编辑:李宏,2004年3月18日 ##### while true do echo "\n" echo "\t\t 石首市联社显示或打印通知程序\n" echo "\t\t 开发作者:李宏 \n" echo "\t\t <1> 显示通知内容 " echo "\t\t <2> 打印通知内容 " echo "\t\t <3> 退出 \n" echo "\t\t请选择: \c" read sel rest [ "$sel" ] || continue sel_long=`expr length $sel` [ $sel_long -eq 1 ] || continue [ $sel -ge 1 -a $sel -le 2 ] && break [ $sel -eq 3 ] && { echo "\n\n\t\t您选择了退出!按回车键退出!\c" read wait return 1 } done check_file
case $sel in 1) ### echo "\n\n显示通知内容.......\c" more_TONGZHI return 1 ; 2) ### echo "\n\n打印通知内容.......\c" print_TONGZHI esac
| |
阅读(818) | 评论(0) | 转发(0) |