خرید بک لینک

Vote count: 0

I have this Python 3 code stored in pipe.py, which accepts some piped input and prints it line-by-line:

import sys

for i, line in enumerate(sys.stdin):
    print("{}: {}".format(i, line))

I can then run this in Bash:

$ echo "Test" | python pipe.py
0: Test

This is working as intended, but what I'm interested in is if there is a way to actually get the command run which resulted in the piped input. So, for my example above, the value Test was piped into the program, but echo "Test" was executed to get this value.

Is there a way I can get that echo "Test" command as a string in my Python program?

asked 25 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 13 فروردين 1395 ساعت: 22:36

صفحه بندی