motd-gen

my motd scripts
git clone git://git.ckyln.com/~cem/motd-gen.git
Log | Files | Refs | README | LICENSE

gen-motd (530B)


      1 #!/usr/bin/env sh
      2 
      3 VER=vnumber
      4 
      5 usage() { printf "usage: ${0##*/} [-f motd file] -[h|v]\\n\\n" ; exit 1;}
      6 printversion() { printf "${0##*/}-$VER\\n" ; exit 0;}
      7 
      8 [ "$1" = "--help" ] || [ "$1" = "-h" ] && usage
      9 [ "$1" = "--version" ] || [ "$1" = "-v" ] && printversion
     10 
     11 if [ "$1" = "-f" ] ; then
     12 	[ -z "$2" ] && exit 1
     13 	file="$2"
     14 fi
     15 [ -z "$file" ] && file="/etc/motd"
     16 
     17 if ! :> "$file"; then
     18 	printf "ERROR: You do not have write access to $file\\n"
     19 	exit 1
     20 fi
     21 
     22 for motd in SHAREDIR/motd-scripts/*.motd; do
     23 	. "$motd"
     24 done > "$file"