Full command line as it was typed

后端 未结 8 2095
猫巷女王i
猫巷女王i 2020-12-01 20:56

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 pr

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 21:23

    On Linux there is /proc//cmdline that is in the format of argv[] (i.e. there is 0x00 between all the lines and you can't really know how many strings there are since you don't get the argc; though you will know it when the file runs out of data ;).

    You can be sure that that commandline is already munged too since all escaping/variable filling is done and parameters are nicely packaged (no extra spaces between parameters, etc.).

提交回复
热议问题