I am quite a newbie to Linux. I have a very simple Python script that accepts command line arguments and prints them. Now I just want to pass the date
command's output as input to this Python script and print it. The Python script looks like this.
import sys
print "command line arguments recieved are"
for i in range(0,len(sys.argv)) :
print sys.argv[i]
While running this program in order to pass the date
command's output to script I just did
date | python exmp.py
Is this the right way to pass one command's output as input of a program? My program is not taking input from date command. The output I am getting looks like this
command line arguments recieved are
exmp.py
I am really unable to find out what wrong thing am I doing. Please help me in resolving this.