Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #For beginners who want a better understanding of shell scripting on Linux systems
- #Coded on Ubuntu 16.04+
- #Execute script in terminal: bash /path/to/script.sh or ./path/to/script.sh
- clear
- # INITIALIZATION
- echo -e '\033]2;Terminal\007'
- KEY=$RANDOM
- until [[ $sac == $KEY ]] ; do
- clear
- read -p "Session Access Key: " sac
- if [[ $sac == "/grant" ]] ; then
- echo
- echo $KEY
- sleep 2
- elif [[ $sac == $KEY ]] ; then
- echo
- echo Access granted!
- sleep 1
- else
- echo
- echo Access Denied!
- exit 0
- fi
- done
- # FUNCTIONS
- doFunc1() {
- echo "This is the first function."
- sleep 1
- }
- doFunc2() {
- echo "This is the second function."
- sleep 1
- }
- doFunc3() {
- echo "This is the third function."
- sleep 1
- }
- # MAIN LOOP
- while true ; do
- clear
- echo "1) doFunc1"
- echo "2) doFunc2"
- echo "3) doFunc3"
- echo
- read -p '$ ' opt
- case "$opt" in
- "1")
- doFunc1 ;;
- "2")
- doFunc2 ;;
- "3")
- doFunc3 ;;
- *)
- echo "This is not a function."
- sleep 1 ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement