Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created November 30, 2014 19:53
Show Gist options
  • Select an option

  • Save nikAizuddin/6683bad9512b50cc128f to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/6683bad9512b50cc128f to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (BASH)
#!/bin/bash
# ==========================================================
# Write a shell script base on below requirements:
#
# a) Script prompt user to enter a password
#
# b) Script then checks the password entered with the given
# password. (Assume that the system password is "secret")
#
# c) Script will display "You have access!!" if password is
# correct or "Get out from this system" if password is
# wrong.
# ==========================================================
echo -n "Password: "
read password
if [[ "$password" = "secret" ]]; then
echo "You have access!!"
else
echo "Get out from this system"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment