Chaining in a command line several tranformations with options

喜欢而已 提交于 2019-12-02 10:19:59

The pipeline should be provided as a single argument (with possible spaces in it, e.g. using shell quoting) of my program.

The pipeline could be split into several filters by +s that is by \s+\+\s+ regexp. However while splitting quoted + (\+) shall be ignored.

Then every filter is processed as a separate command line (e.g. using argparse). Before passing to argparse every filter shall be split on whytespace.

Also, \ quotes whitespaces (so that the filter is not split at this space) and itself (\\).

Note that providing the pipeline as a single argument is hinted by calling shell pipelines like sh -c 'tr a-z A-Z | tac' (here the pipeline is a single argument of sh program).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!