Skip to content

Instantly share code, notes, and snippets.

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

  • Save nikAizuddin/9a0666b8f0259f5dd7ab to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/9a0666b8f0259f5dd7ab to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (RUBY)
#!/bin/ruby
# ==========================================================
# 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.
# ==========================================================
printf("Password: ");
password = gets.chomp;
if password == "secret"
printf("You have access!!\n");
else
printf("Get out from this system\n");
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment