#! /bin/csh 

#######################################################
# coolOS 
#######################################################

#echo -n "enter in 0 or 1 "
#set num1 = $<
mkdir folder
who > ulog.txt
date > dlog.txt
cat ulog.txt dlog.txt > log.txt
@ num1 = 0
@ num2 = 0
@ numS = 0
@ numD = 0
while ($num1 != "6")
#######MAIN MENU#### MENU 0
clear
echo "Hello $USER"
date
echo ""
echo "         W  E  L  C  O  M  E  2  coolOS"
echo ""
echo "                           created by: michael kim"
echo "                                       jesus davila"
echo ""
echo "               |----------------------------------|"
echo "               |    M A I N  M E N U  I T E M S   |"
echo "               |----------------------------------|"
echo "               |1.| File Utilities                |"
echo "               |2.| Display and Kill Processes    |"
echo "               |3.| Create Alias                  |"
echo "               |4.| Play a Game                   |"
echo "               |5.| Display Envrinment Variables  |"
echo "               |6.| Exit coolOS!                  |"
echo "               |----------------------------------|"
echo ""
echo "enter menu item:"
set num1 = $<

##################################################
##################################################
###File Utilities Menu  MENU 1

while ($num1 == "1")

clear
echo ""
echo ""
echo ""
echo "         W  E  L  C  O  M  E  2  coolOS"
echo ""
echo "                           created by: michael kim"
echo "                                       jesus davila"
echo ""
echo "               |----------------------------------|"
echo "               |    F I L E  U T I L I T I E S    |"
echo "               |----------------------------------|"
echo "               |1.| Display File                  |"
echo "               |2.| Print File                    |"
echo "               |3.| Move File                     |"
echo "               |4.| Delete File                   |"
echo "               |  |                               |"
echo "               |0.| Return to Main Menu           |"
echo "               |----------------------------------|"
echo ""
echo "enter menu item:"
set num2 = $<

if ($num2 == "1") then 
clear
ls -l
echo "enter file name to display:"
set num1 = $<
less $num1
endif

if ($num2 == "2") then 
clear
ls -l
echo "enter file name to print:"
set num1 = $<
a2ps $num1
endif

if ($num2 == "3") then                   
clear
ls -l
echo "enter file name to move:"
set num1 = $<
echo "enter source directory:"
set numS = $<
echo "enter destination directory:"
set numD = $<
mw $numS/$num1 $numD/$num1
endif

if ($num2 == "4") then 
clear
ls -l
echo "enter file name you want to delete"
set num1 = $<
rm $num1
endif

if ($num2 == "0") then 
@ num1 = 0
endif
end

##################################################
##################################################
###DISPLAY AND KILL PROCESSES Menu  MENU 2

while ($num1 == "2")

clear
echo ""
echo ""
echo ""
echo "         W  E  L  C  O  M  E  2  coolOS"
echo ""
echo "                           created by: michael kim"
echo "                                       jesus davila"
echo ""
echo "               |----------------------------------|"
echo "               |        P R O C E S S E S         |"
echo "               |----------------------------------|"
echo "               |1.| Display Processes             |"
echo "               |2.| Kill Processes                |"
echo "               |  |                               |"
echo "               |  |                               |"
echo "               |  |                               |"
echo "               |0.| Return to Main Menu           |"
echo "               |----------------------------------|"
echo ""
echo "enter menu item:"
set num2 = $<

if ($num2 == "1") then 
clear
ps 
set num2 = $<
endif

if ($num2 == "2") then 
echo "enter Process ID of which you want to kill"
set num1 = $<
ps
kill $num1
ps
endif

if ($num2 == "0") then 
@ num1 = 0
endif

end


##################################################
##################################################
###CREATE ALIAS MENU 3

while ($num1 == "3")
clear
echo "ALIAS"
echo "enter command:"
set num2 = $<
echo "enter alias name:"
set numD = $<

alias $numD '$num2'

@ num1 = 0


end


##################################################
##################################################
###PLAY A GAME  MENU 4

while ($num1 == "4")

clear
echo ""
echo ""
echo ""
echo "         W  E  L  C  O  M  E  2  coolOS"
echo ""
echo "                           created by: michael kim"
echo "                                       jesus davila"
echo ""
echo "               |----------------------------------|"
echo "               |       G A M E S                  |"
echo "               |----------------------------------|"
echo "               |1.| Chromium                      |"
echo "               |2.| Maelstrom                     |"
echo "               |  |                               |"
echo "               |  |                               |"
echo "               |  |                               |"
echo "               |0.| Return to Main Menu           |"
echo "               |----------------------------------|"
echo ""
echo "enter menu item:"
set num2 = $<

if ($num2 == "1") then 
clear
cd /usr/games/chromium
chromium
cd 
endif

if ($num2 == "2") then 
clear
cd /usr/games/Maelstrom
Maelstrom
cd 
endif


if ($num2 == "0") then 
@ num1 = 0
endif

end



##################################################
##################################################
###DISPLAY ENVRINMENTAL VARIABLES  MENU 5

while ($num1 == "5")

clear
printenv | less

@ num1 = 0
end


#### END OF WHILE LOOP  AKA EXIT
clear
echo "exited coolOS"
end

