To understand xargs better

前端 未结 3 1449
一个人的身影
一个人的身影 2021-01-20 14:14

I want to understand the use of xargs man in Rampion\'s code:

screen -t man /bin/sh -c \'xargs man || read\'

Thanks to Ram

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 15:01

    No, I don't cat nothing. I cat whatever input I get after I run the command. cat is actually extraneous here, so let's ignore it.

    xargs man waits on user input. Which is necessary. Since in the script you grabbed that from, I can't paste in the argument for man until after I create the window. So the command that runs in the window needs to wait for me to give it something, before it tries to run man.

    If we just ran screen /bin/sh -d 'man || read', it would always complain "What manual page do you want?" since we never told it.

提交回复
热议问题