Skip to content

Instantly share code, notes, and snippets.

@iamsenorespana
Created November 3, 2020 15:13
Show Gist options
  • Save iamsenorespana/1eb1ee21862066e480f511655f006639 to your computer and use it in GitHub Desktop.
Save iamsenorespana/1eb1ee21862066e480f511655f006639 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "";
echo "---- Welcome to Counting ----";
echo "";
for x in one two three four five six seven eight nine ten
do
echo "Hello Number: $x"
if [ "$x" = "three" ]; then
echo "";
echo "============================================";
echo "== My Favorite Number is 3 ==";
echo "============================================";
echo "";
fi
done
echo "----- DONE ----";
echo "";
#!/bin/bash
echo "";
#!/bin/bash
echo -n "Enter the name of a country: "
read COUNTRY
echo "";
echo -n "The official language of $COUNTRY is "
echo "";
case $COUNTRY in
Lithuania)
echo -n "Lithuanian"
;;
Romania | Moldova)
echo -n "Romanian"
;;
Italy | "San Marino" | Switzerland | "Vatican City")
echo -n "Italian"
;;
USA | "United States" )
echo -n "United States of America"
;;
*)
echo -n "unknown"
;;
esac
#!/bin/bash
EXIT=0
while [ $EXIT -ne "9" ];
do
#!/bin/bash
EXIT=0
while [ $EXIT -ne "9" ];
do
echo "";
echo "===================";
echo " WELCOME TO MENU ";
echo "===================";
echo "";
echo " Choose an option below:";
echo " 1) get current directory ";
echo " 2) list files in directory";
echo " 3) list my scripts in directory";
echo " 4) show me shortcuts";
echo " 5) create a folder";
echo " 6) create a file";
echo " 9) exit";
echo "";
read -rp "Please make a selection: " userselection;
case "$userselection" in
1)
echo "You chose option 1";
echo "";
echo "Your Current Directory is: ";
pwd;
echo "";
;;
3)
echo "You chose option 3";
echo "";
ls -al *.sh;
echo "";
;;
4)
echo "You chose option 4";
echo "";
alias
echo "";
;;
6)
echo "you chose option 6";
echo "";
read -rp "what is file name? " filename;
if [ "$filename" != "" ]; then
# name is not blank
if [ -f "$filename" ]; then
# File does exist, ask to copy or move
read -rp "File Exists, do you want to copy it to new file? (Y/N) " answer;
if [ "$answer" == 'Y' ]; then
#ask for new filename
else
# make the file
fi
else
# make the file
fi
else
#name blank, show error
fi
;;
5)
echo "You chose option 5";
echo "";
read -rp "what is the name of folder you want to create ? " newfolder;
if [ "$newfolder" != "" ]; then
if [ -d "$newfolder" ]; then
echo "";
echo "== ERROR: FOLDER ALREADY EXISTS";
echo "";
else
mkdir $newfolder;
fi
else
echo "";
echo "Folder Name is required";
EXIT=5;
echo "";
fi
echo "";
;;
2)
echo "You chose option 2";
echo "";
echo "=========================";
echo "=== Your File Listing ===";
echo "=========================";
ls -al;
echo "=========================";
echo "";
;;
9)
echo "You want to exit, Goodbye";
echo "";
#exit 1;
EXIT=9;
echo "";
;;
*)
echo "=====================";
echo " YOU MUST ONLY ENTER";
echo " NUMBER 1,2,3,9 ";
echo "======================"
echo "";
;;
esac
done
echo "";
echo "===================";
echo " WELCOME TO MENU ";
echo "===================";
echo "";
echo " Choose an option below:";
echo " 1) get current directory ";
echo " 2) list files in directory";
echo " 9) exit";
echo "";
read -rp "Please make a selection: " userselection;
case "$userselection" in
1)
echo "You chose option 1";
echo "";
;;
2)
echo "You chose option 2";
echo "";
;;
9)
echo "You want to exit, Goodbye";
echo "";
#exit 1;
EXIT=9;
echo "";
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment