CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
[HELP] convert Perl script to Bash shell script


New User

Apr 21, 2011, 7:50 AM

Post #1 of 2 (540 views)
[HELP] convert Perl script to Bash shell script Can't Post

Hi everybody;

Need help converting the following Perl script to Bash shell script :

#!/usr/bin/perl -w 
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 ;


Apr 21, 2011, 9:07 AM

Post #2 of 2 (536 views)
Re: [Egypte] [HELP] convert Perl script to Bash shell script [In reply to] Can't Post

For catching interrupts, see the 'trap' command of bash.

For the argument in the while loop, see the


which is convenient for doing arithmetic evaluation.

For reading from STDIN, see the read command.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives