Created
November 30, 2014 20:00
-
-
Save nikAizuddin/cfbae9b3833abcd992df to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (PERL)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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