Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 21st, 2011, 09:54 AM
saeeddeep saeeddeep is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 3 saeeddeep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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 ;

Reply With Quote
  #2  
Old April 21st, 2011, 04:22 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 738 OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 46 m 27 sec
Reputation Power: 928
The best solution is don't use bash for this; there are plenty of good ways to authenticate a user (pam(8)).

If you must do this in bash for some reason read the man page for bash paying attention to the built-ins.

For hashing you can look at utilities like sha1sum(1) or openssl's dgst(1).


If you need help, post your attempt (placing your code/data in [code][/code] tags so it's legible!) and ask a specific question (showing any relevant error messages or input/output). You're unlikely to get a complete script written for you--that's not what these forums are for.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Shell - [HELP] convert Perl script to Bash shell script

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap