
April 21st, 2011, 09:54 AM
|
|
Registered User
|
|
Join Date: Apr 2008
Posts: 3
Time spent in forums: 40 m 14 sec
Reputation Power: 0
|
|
|
Shell - [HELP] convert Perl script to Bash shell script
Hi everybody;
Need help converting the following Perl script to Bash shell script :
Code:
#!/usr/bin/perl -w
$SIG{INT} = 'IGNORE';
$SIG{TSTP} = 'IGNORE';
$SIG{TERM} = 'IGNORE';
$SIG{QUIT} = 'IGNORE';
print " Challenge1 : ";chomp($a=<STDIN>);
print " Challenge2 : ";chomp($b=<STDIN>);
while ($a ne "123456" || $b ne "456789"){
print " Challenge1 : ";chomp($a=<STDIN>);
print " Challenge2 : ";chomp($b=<STDIN>);
}
I understand it's a simple while loop checks the STDIN values "Challenge1, and Challenege2" compared to "123456 and 456789" if correct it exit the loop or else ask for Challenges again. I'm pretty sure it's a nooby question and I'd better to learn Shell scripting but I really need it as soon as possible.
Also I've another question; How to store the reference values(i.e; 123456 and 456789) of Challenge1 and Challenge2 in an encrypted form say MD5 and even more save those values in another text file rather than showing them in the same shell script (i.e; compare STDIN to reference values in /home/user/challenges.txt).
Thanks in advance ;
|