I need to execute my python program in the following way:
echo -e arg1|myprogram.py
.
In this way if I try to get the arguemnts passed to my program I get an nothing ( print(sys.arg)
). How is it possible to get the arguments like that?
I need to execute my python program in the following way:
echo -e arg1|myprogram.py
.
In this way if I try to get the arguemnts passed to my program I get an nothing ( print(sys.arg)
). How is it possible to get the arguments like that?
Try that script
import sys
print(sys.argv, sys.stdin.read())
And run
echo "a" | python test.py
['test.py'] a