ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there any software available which will convert a bash script to perl? Are the two that similar? My bash script basically makes a text config file based on the answers to some questions.
From what I understand, you can't really do this (beyond the simplest, most hackish surface level). A shell script is normally a wrapper - a little syntax that calls a bunch of external commands (grep, echo, gawk, sed, cat, etc.). To really rewrite that in Perl - both the syntax and the external commands - you need a human.
Also, in the process, you would almost certainly want to write it to Perl's strengths - ie, rethink the methods, data structures, algorithms, etc. Again, that would need a human.
Edit: see this link, which seems to have a post from our very own Chrism.
Last edited by Telemachos; 01-02-2009 at 09:27 AM.
Reason: Added a link to a PerlMonks posting
I love it when people say "try searching" then present a google page with 900forums all with the same problem - thanks for that, I'd not even thought of using a search engine prior to writing this post. Unihiekka can you please refrain from the sarcastic useless belittling elitist crap in future.
Telemachos I'd read about sh2p but I also read somewhere it was a joke In fact on the page you showed me; the last comment describes it being an april fools joke and puts the entire code inside a system call. It's probably a bad idea using a conversion tool anyway, I've never had much luck with them.
I guess it's time to learn perl Thanks for your help.
I'd read about sh2p but I also read somewhere it was a joke In fact on the page you showed me; the last comment describes it being an april fools joke and puts the entire code inside a system call. It's probably a bad idea using a conversion tool anyway, I've never had much luck with them.
I didn't give the link to suggest you use sh2p, but to show you that many experienced Perlistas (?!) say that it takes (a great deal of) human intervention to turn shell scripts into Perl.
Gotcha - cheers mi dears. I think I have an Oreilly book somewhere, thanks for the links Tasks like this are usually good ways to introduce yourselff to programming languages anyway. Once again, thanks for the advice, much appreciated.
... I'd read about sh2p but I also read somewhere it was a joke In fact on the page you showed me; the last comment describes it being an april fools joke and puts the entire code inside a system call. It's probably a bad idea using a conversion tool anyway, I've never had much luck with them ...
Minor comment: my reading of the post by Schwartz (http://www.perlmonks.org/?node_id=577182) is that it was the first entry (Oct 09, 2006). There is a recent (9th October 2008: Now on version 0.04 and have gone beta) entry in CPAN by the author as noted in the update section of the main post. I looked at it on CPAN briefly, but have not tried it, however.
Clive Darke, the author, writes: It does not attempt to redesign the script for Perl but to assist in the conversion process by automating much of the tedium.. That might make it useful for some conversion tasks ... cheers, makyo
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.