Skip to content

Instantly share code, notes, and snippets.

@ItsYanko
Last active April 2, 2018 23:18
Show Gist options
  • Save ItsYanko/c09b5778aa140490d2a9bb9843050ac0 to your computer and use it in GitHub Desktop.
Save ItsYanko/c09b5778aa140490d2a9bb9843050ac0 to your computer and use it in GitHub Desktop.
Simple SHELL Login System by IanPP
#!bin/sh
#This is a simple Login system
#Project done by IanPP
#PreConfig - VAR
confirmTrue="true"
confirmFalse="false"
first_config=`cat ./files/config/confirm_config.txt`
username=`cat ./files/config/username.txt`
password=`cat ./files/config/password.txt`
#End of PreConfig - VAR
clear
echo "Hello, verifying first configuration..."
if [ "$first_config" = "$confirmFalse"] #If the first configuration wasn't done, redirects to the FirstConfig Program
then
sleep 1 #Gives a 1 second delay
echo "--Redirecting to First Configuration Program"
sh ./files/firstconfig.sh #Redirects to the FirstConfig program
fi
if [ "$first_config" = "$confirmTrue"]
then
echo "--The First Configuration was already done!"
fi
echo "LOGIN"
echo "Insert Username:"
read insert_usr
echo "Insert Password for $insert_Usr"
read insert_pswd
echo
echo "--Processing data"
echo "--Validating Username and Password"
if [ "$insert_usr" = "$username && "$insert_pswd" = "$password" ]
then
echo "--Username and Password Correct!"
else
echo "--Username or Password incorrect, exiting"
fi
$SHELL #To keep the terminal open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment