EASY (repost)

Danny Shaw danny at neptune.iex.com
Thu Feb 14 03:34:18 AEST 1991


This is a very early attempt I had at a menu driven UNIX front end for
novice users.

It is written in ksh. Sorry haven't had time to port it to sh or csh
Put the file 'easy' in /usr/local/bin.
Put the file 'easy.h' and 'easy.time' in /usr/local/bin.
type % easy
You will probably need to modify the Main menu to use something other than
ELM, RN, and Tsheet.
It is in no way Garaunteed, all liabilities are that of the user.
Feel free to Modify in any way.

Mail me suggestions or comments as to how it could be better.

To extract type

% cpio -ivcB < EASY

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ uunet!iex!neptune!danny   ~  IEX CORPORATION-      ~
~ Whats in a sig. anyway?   ~  1400 Preston rd. #350 ~
~                           ~  Plano, TX. 75093      ~
~i'd rather be water skiing ~  (214) 612-2600        ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


<*-*-*-*-*-*-*-*-*-*-*-*-*CUT HERE-*-*-*-*-*CUT HERE*-*-*-*-*-*-*-*-*-*-*-*-*-*>

0707070034165101410407750005570003100000021742320475626421100000200000000000.0707070034165101421007750005570003100000011770200475626356400000700000025451easy.h# !/bin/ksh
################################################################################
# A script to help Non-UNIX users move through a Unix environment.
# Written by: Danny Shaw
# Last Modification date: 2/12/91
################################################################################

# Set up variables #

CLEARLN='tput el'
MESSLOC='tput cup 24 15'
HELPLOC='tput cup 23 15'
BOLD=`tput smso`
OFF=`tput rmso`
BELL='tput bel'
FNAME=`awk -F":" '$1 == "'$USER'" {print $5} ' /etc/passwd | cut -d" " -f1`
INFO="Type <RETURN> to continue..."
INVALID="Type file name or <q> to return to the menu screen.  ->  "
MESSAGE="Enter the number or name of desired function..."
HELP="Type <RETURN> for a listing of available files..."
TIME1='/usr/local/lib/easy.time -1 &'
TIME2='/usr/local/lib/easy.time -2 &'

# Draw the main menu screen #

clear
while true
 do
   clear
   date '+DATE: %m/%d/%y'
   /usr/bin/echo "                             ${BOLD}IEX Corporation${OFF}
                          MENU driven UNIX system." 
   /usr/bin/echo ""
   /usr/bin/echo -n ${FNAME}", Type:
			${BOLD} 1 ${OFF} to read mail (elm)
			
			${BOLD} 2 ${OFF} to read news (rn)

			${BOLD} 3 ${OFF} file/directory management

			${BOLD} 4 ${OFF} Tsheet

			${BOLD} 5 ${OFF} Fortune

			${BOLD} 6 ${OFF} UNIX-SHELL

			${BOLD} q ${OFF} to quit

			- > [    ]"

	$MESSLOC
	echo -n ${BOLD}$MESSAGE${OFF}
	eval $TIME1 
    TIMEPID=$!

# If named option is given redefine it to a numarical value #

   read ANS FILE
	case $ANS in
		elm)
			ANS="1"
		;;
		rn)
			ANS="2"
		;;
		[Tt]sheet)
			ANS="4"
		;;
		[Ff]ortune)
			ANS="5"
		;;
		[Uu]*[Xx])
			ANS="6"
		;;
		[Ss]*[Ll])
			ANS="6"
		;;
		[Qq]*[Tt])
			ANS="q"
		;;
	esac

# Main menu selections #

   case $ANS in
     1) 
		kill -9 $TIMEPID 
		$MESSLOC
		$CLEARLN
		$MESSLOC
       /usr/bin/echo -n "Read Mail? 
Please answer ${BOLD} Y ${OFF}es or ${BOLD} N ${OFF}o...
       - > "
       $BELL
       while read FILE
         do 
           case $FILE in
             [Nn])
               break
              ;;
             [Yy])
                 if [ $FILE = "q" ]
                   then
                     break
                 else
                   /usr/local/bin/elm
                   break
                 fi
              ;;
           esac
         done
     ;;
     2) 
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		echo
       /usr/bin/echo -n "Read News? 
Please answer ${BOLD} Y ${OFF}es or ${BOLD} N ${OFF}o...
       - > "
       $BELL
       while read FILE
         do 
           case $FILE in
             [Nn])
               break
              ;;
             [Yy])
                 if [ $FILE = "q" ]
                   then
                     break
                 else
                   clear
                   /usr/local/bin/rn
                   break
                 fi
              ;;
           esac
         done
     ;;

# Draw Sub-menu menu screen #

     3) 
		kill -9 $TIMEPID
       clear
       while true
       do
         clear
         date '+DATE: %m/%d/%y'
         /usr/bin/echo "                            FILE MANAGEMENT SYSTEM" 
         /usr/bin/echo
         /usr/bin/echo -n $FNAME", Type:
			${BOLD} 1 ${OFF} to view a file (more)
				
			${BOLD} 2 ${OFF} to edit a file (vi)

			${BOLD} 3 ${OFF} to print a file (lpr)

			${BOLD} 4 ${OFF} to copy a file (cp)
				
			${BOLD} 5 ${OFF} to rename a file (mv)

			${BOLD} 6 ${OFF} to delete a file (rm)

			${BOLD} 7 ${OFF} to list a directory (ls)

			${BOLD} 8 ${OFF} to change directories (cd)

			${BOLD} q ${OFF} to quit to main menu

			- > [    ]"

			$MESSLOC
			echo -n ${BOLD}$MESSAGE${OFF}
			eval $TIME2
   			TIMEPID=$!

# If named option is given redefine it to a numarical value #

        read ANS FILE
			case $ANS in
				more)
	   				ANS="1"
				;;
				vi)
					ANS="2"
				;;
				lpr)
					ANS="3"
				;;
				cp)
					ANS="4"
				;;
				mv)
					ANS="5"
				;;
				rm)
					ANS="6"
				;;
				ls)
					ANS="7"
				;;
				cd)
					ANS="8"
				;;
				[Qq]*[Tt])
					ANS="q"
				;;
			esac

# Sub-menu selections for file manipulation #

        case $ANS in
          1)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n  "view what file?
            - > "
            $BELL
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s $FILE ]
                    then
                    more $FILE
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
            clear
          ;;
          2) 
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "vi what file?
          - > "
            $BELL -p
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s "$FILE" ]
                    then
                    vi $FILE
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
          3)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "print what file?
             - > "
            $BELL -p
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s "$FILE" ]
                    then
                    lpr -P$PRINTER $FILE
                    /usr/bin/echo "File has been printed to your default printer"
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
          4)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "copy what file?
            - > " 
            $BELL -p
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s "$FILE" ]
                    then
                    /usr/bin/echo -n "Enter the new file name: "
                    read ANS
                    cp $FILE $ANS
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
          5)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "rename what file?
              - > "
            $BELL -p
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s "$FILE" ]
                    then
                    /usr/bin/echo -n "Enter the new file name: "
                    read ANS
                    mv $FILE $ANS
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
          6)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "delete what file?
              - > "
            $BELL -p
            while read FILE
            do
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -s "$FILE" ]
                    then
                    rm -i $FILE 
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
          7)
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            clear
            ls -Ff
			echo "Current directory is "$PWD
			echo
            /usr/bin/echo -n $INFO
            read ANS
            $BELL
          ;;
          8) 
			kill -9 $TIMEPID
			$MESSLOC
			$CLEARLN
			$MESSLOC
			$HELPLOC
			echo ${BOLD}$HELP${OFF}
            /usr/bin/echo -n "cd to what directory? 
                  - > "
            $BELL
            while read FILE
            do 
              if [ -z "$FILE" ]
                then
                clear
                ls -Ff
				echo "Current directory is "$PWD
                /usr/bin/echo -n $INVALID
                $BELL
              else
                if [ $FILE = "q" ]
                  then
                  break
                else
                  if [ -d "$FILE" ]
                    then
                    cd $FILE
					echo "Current directory is "$PWD
					echo
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
         [qQ]) 
			kill -9 $TIMEPID
              break
          ;;
		 *)	
			kill -9 $TIMEPID
		  ;;
        esac
      done
     ;;
	4) 
		kill -9 $TIMEPID
		/usr/local/bin/tsheet
   		echo $INFO
	;;
	5)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		/usr/games/fortune
   		echo $INFO
		read ANS
	;;
	6)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		echo "Type 'exit' when you want to leave the UNIX-SHELL"
		echo "Hit <RETURN>..."
		read ANS
		clear
		/bin/csh -i
	;;
    [qQ]) 
		kill -9 $TIMEPID
		        break
     ;;
     *) /usr/bin/echo Sorry that name is not recognized
         /usr/bin/echo $INFO
         /usr/bin/echo WHOOPS
		 read ANS
		kill -9 $TIMEPID
     ;;
   esac
   done
   /usr/bin/echo "See Ya" $FNAME", It has been fun!"
sleep 2
clear
exit
0707070034165101431007750005570003100000011742370475626356400001200000000677easy.timefor ARG in $*
do case $ARG in
	-1) CURLOC='tput cup 19 29'
	;;
	-2) CURLOC='tput cup 22 29'
	;;
	esac
done
TIMELOC='tput cup 0 63'
HOUR=`date '+%H'`
MIN=`date '+%M'`
SEC=`date '+%S'`
while [ $HOUR -lt 24 ]
do
	while [ $MIN -lt 60 ]
	do
		while [ $SEC -lt 60 ]
		do 
			$TIMELOC
			echo -n "Time: $HOUR:$MIN:$SEC   "   
			$CURLOC
			sleep 5
			SEC=`expr $SEC + 5`
		done
		SEC=0
		MIN=`expr $MIN + 1`
	done
	MIN=0
	HOUR=`expr $HOUR + 1`
done
echo
0707070034165101441007750005570003100000010033170475626357500000500000000042easy/usr/local/lib/easy.h 2>/dev/null
0707070034165101441007750005570003100000010033170475626357500001300000000000TRAILER!!!FILE
					echo "Current directory is "$PWD
					echo
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
         [qQ]) 
			kill -9 $TIMEPID
              break
          ;;
		 *)	
			kill -9 $TIMEPID
		  ;;
        esac
      done
     ;;
	4) 
		kill -9 $TIMEPID
		/usr/local/bin/tsheet
   		echo $INFO
	;;
	5)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		/usr/games/fortune
   		echo $INFO
		read ANS
	;;
	6)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		echo "Type 'exit' when you want to leave the UNIX-SHELL"
		echo "Hit <RETURN>..."
		read ANS
		clear
		/bin/csh -i
	;;
    [qQ]) 
		kill -9 $TIMEPID
		        break
     ;;
     *) /usr/bin/echo Sorry that name is not recognized
         /usr/bin/echo $INFO
         /usr/bin/echo WHOOPS
		 read ANS
		kill -9 $TIMEPID
     ;;
   esac
   done
   /usr/bin/echo "See Ya" $FNAME", It has been fun!"
sleep 2
clear
exit
0707070034165101431007750005570003100000011742370475626356400001200000000677easy.timefor ARG in $*
do case $ARG in
	-1) CURLOC='tput cup 19 29'
	;;
	-2) CURLOC='tput cup 22 29'
	;;
	esac
done
TIMELOC='tput cup 0 63'
HOUR=`date '+%H'`
MIN=`date '+%M'`
SEC=`date '+%S'`
while [ $HOUR -lt 24 ]
do
	while [ $MIN -lt 60 ]
	do
		while [ $SEC -lt 60 ]
		do 
			$TIMELOC
			echo -n "Time: $HOUR:$MIN:$SEC   "   
			$CURLOC
			sleep 5
			SEC=`expr $SEC + 5`
		done
		SEC=0
		MIN=`expr $MIN + 1`
	done
	MIN=0
	HOUR=`expr $HOUR + 1`
done
echo
0707070034165101441007750005570003100000010033170475626357500000500000000042easy/usr/local/lib/easy.h 2>/dev/null
0707070034165101441007750005570003100000010033170475626357500001300000000000TRAILER!!!FILE
					echo "Current directory is "$PWD
					echo
                    /usr/bin/echo -n $INVALID
                  fi
                fi
              fi
            done
          ;;
         [qQ]) 
			kill -9 $TIMEPID
              break
          ;;
		 *)	
			kill -9 $TIMEPID
		  ;;
        esac
      done
     ;;
	4) 
		kill -9 $TIMEPID
		/usr/local/bin/tsheet
   		echo $INFO
	;;
	5)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		/usr/games/fortune
   		echo $INFO
		read ANS
	;;
	6)
		kill -9 $TIMEPID
		$MESSLOC
		$CLEARLN
		$MESSLOC
		echo "Type 'exit' when you want to leave the UNIX-SHELL"
		echo "Hit <RETURN>..."
		read ANS
		clear
		/bin/csh -i
	;;
    [qQ]) 
		kill -9 $TIMEPID
		        break
     ;;
     *) /usr/bin/echo Sorry that name is not recognized
         /usr/bin/echo $INFO
         /usr/bin/echo WHOOPS
		 read ANS
		kill -9 $TIMEPID
     ;;
   esac
   done
   /usr/bin/echo "See Ya" $FNAME", It has been fun!"
sleep 2
clear
exit
0707070034165101431007750005570003100000011742370475626356400001200000000677easy.timefor ARG in $*
do case $ARG in
	-1) CURLOC='tput cup 19 29'
	;;
	-2) CURLOC='tput cup 22 29'
	;;
	esac
done
TIMELOC='tput cup 0 63'
HOUR=`date '+%H'`
MIN=`date '+%M'`
SEC=`date '+%S'`
while [ $HOUR -lt 24 ]
do
	while [ $MIN -lt 60 ]
	do
		while [ $SEC -lt 60 ]
		do 
			$TIMELOC
			echo -n "Time: $HOUR:$MIN:$SEC   "   
			$CURLOC
			sleep 5
			SEC=`expr $SEC + 5`
		done
		SEC=0
		MIN=`expr $MIN + 1`
	done
	MIN=0
	HOUR=`expr $HOUR + 1`
done
echo
0707070034165101441007750005570003100000010033170475626357500000500000000042easy/usr/local/lib/easy.h 2>/dev/null
0707070034165101441007750005570003100000010033170475626357500001300000000000TRAILER!!!FILE



More information about the Alt.sources mailing list