Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: system command has problem with '>>'

by mnooning (Sexton)
on Mar 30, 2010 at 00:26 UTC ( #831736=note: print w/ replies, xml ) Need Help??


in reply to Re: system command has problem with '>>'
in thread system command has problem with '>>'

Not true. The shell processes '>>', not 'ls', as can be seen from the pastes below.
Anyone else have any ideas on this?

$ rm aa
$ ls example_file.txt >> aa
$ cat aa
example_file.txt
$ ls exam*
example_file.txt
$ ls example_file.txt >> aa
$ cat aa
example_file.txt
example_file.txt


Comment on Re^2: system command has problem with '>>'
Re^3: system command has problem with '>>'
by Anonymous Monk on Mar 30, 2010 at 00:45 UTC
    Not true. The shell processes '>>', not 'ls', as can be seen from the pastes below.

    Thats what I said.

    Anyone else have any ideas on this?

    Like I said, use IPC::System::Simple systemx, it process >> like the shell without invoking the shell, or like JavaFan said, invoke the shell

      it process >> like the shell without invoking the shell

      No.

      $ dir foo ls: foo: No such file or directory $ perl -MIPC::System::Simple=systemx -e'systemx "ls", ">>", "foo"' ls: >>: No such file or directory ls: foo: No such file or directory "ls" unexpectedly returned exit value 2 at -e line 1 $ perl -MIPC::System::Simple=systemx -e'systemx "ls >> foo"' "ls >> foo" failed to start: "No such file or directory" at -e line 1 $ dir foo ls: foo: No such file or directory

      Same goes for 2>&1

      $ perl -MIPC::System::Simple=systemx -e'systemx "ls 2>&1"' "ls 2>&1" failed to start: "No such file or directory" at -e line 1 $ perl -MIPC::System::Simple=systemx -e'systemx "ls", "2>&1"' ls: 2>&1: No such file or directory "ls" unexpectedly returned exit value 2 at -e line 1

      It would defy the entire point of systemx if any argument was treated specially.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-08-30 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls