in reply to Re^2: Semicolon behaviour in system call
in thread Semicolon behaviour in system call

Do you get the same output from

C:\temp> pwd; pwd

as you do from

C:\temp> perl -e 'system("pwd; pwd");'

Do the same check for:

C:\temp> echo 1; echo 2; echo 3

From Perl, you may need to put each command in an array and use "system $_ for @cmds", e.g.

$ perl -e 'my @cmds = ("echo 1", "echo 2", "echo 3", "pwd", "pwd"); sy +stem $_ for @cmds' 1 2 3 /Users/ken/tmp /Users/ken/tmp

[I don't have Perl running on any MSWin platform, so I can't test this for you.]

-- Ken

Replies are listed 'Best First'.
Re^4: Semicolon behaviour in system call
by casual_prgmr (Initiate) on Mar 28, 2014 at 17:34 UTC

    Hi Ken, thanks for that nice option, it doesn't quite work from the command line (issues identifying the closing "'"), but from a script it does the trick regardless of PERL distrib used

      Yes and no. ";" vs "&" is hardly the only difference between sh and cmd. Even the quotes are different.