in reply to Re^2: RFC: UNIX shell to Perl converter
in thread RFC: UNIX shell to Perl converter

No, you can't really eliminate any forks, because you don't know who needs to know $? at the right time, or depends on a certain number of kids being present.

It's like any translation problem... there's the surface syntax, which might appear relatively easy to translate, but then there's the deep semantics: all the side effects of the steps. So you either have to emulate the deep semantics precisely, or you have to analyze and understand enough of the rest of the program to know what you can avoid emulating. Ugh, on either side.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re^3: RFC: UNIX shell to Perl converter

Replies are listed 'Best First'.
Re^4: RFC: UNIX shell to Perl converter
by cdarke (Prior) on Oct 11, 2006 at 07:50 UTC
    Indeed. $? is set by just about any command in the shell (I'm not talking csh here), including [, [[, and ((, so it can affect the entire script, not just forks. Handling this is central to the task.