开发者

How can I convert a shell script into a Perl script?

How can I convert a shell script into a Perl script?

I have a 10k line s开发者_JAVA百科hell script and want to convert it into Perl. Is there any tool is doing that, or is there any way to do that?


There is no simple converter. From Perl FAQ "How-can-I-convert-my-shell-script-to-perl?"

Learn Perl and rewrite it. Seriously, there's no simple converter. Things that are awkward to do in the shell are easy to do in Perl, and this very awkwardness is what would make a shell->perl converter nigh-on impossible to write. By rewriting it, you'll think about what you're really trying to do, and hopefully will escape the shell's pipeline datastream paradigm, which while convenient for some matters, causes many inefficiencies.


  1. Learn whichever shell language the script is written in
  2. Learn Perl
  3. Translate the code
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜