Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created November 30, 2014 20:00
Show Gist options
  • Select an option

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

Select an option

Save nikAizuddin/cfbae9b3833abcd992df to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (PERL)
#!/bin/perl
# ==========================================================
# 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 = <STDIN>;
chomp( $password );
if( $password eq "secret" ) {
printf( "You have access!!\n" );
} else {
printf( "Get out from this system\n" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment