Full command line as it was typed

2019-01-15 05:48发布

I want to get the full command line as it was typed.

This:

" ".join(sys.argv[:])

doesn't work here (deletes double quotes). Also I prefer not to rejoin something that was parsed and split.

Any ideas?

7条回答
太酷不给撩
2楼-- · 2019-01-15 06:11

As mentioned, this probably cannot be done, at least not reliably. In a few cases, you might be able to find a history file for the shell (e.g. - "bash", but not "tcsh") and get the user's typing from that. I don't know how much, if any, control you have over the user's environment.

查看更多
登录 后发表回答