Why child process returns exit status = 32512 in unix?

前端 未结 2 559
后悔当初
后悔当初 2021-02-13 11:43

In my program I\'m executing given command and getting result (log, and exit status). Also my program have to support shell specific commands (i.e. commands which contains shell

2条回答
  •  旧时难觅i
    2021-02-13 12:36

    You should execute sh -c 'ls | wc'.

    Option -c expects a command in form of string. In shell of course it is working, because there is no difference between spawning ls and redirecting output to wc and launching ls | wc in separate shell.

提交回复
热议问题