Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wrote a python programme, that accept I pass an argument inside it. But when I pass a very very long, it automatically shorten my argument. How can I fix it? Thanks.

share|improve this question
    
Can you show us the argument? –  Simon Sheehan Dec 20 '11 at 4:21
add comment

1 Answer

Put all of the arguments in a text file, one per line. Then,

xargs python myprogram.py < argslist.txt

xargs reads in a list of tab, newline, or space-delimited arguments from standard in, and then feeds it to the utility to be executed after additional arguments on the command line.

So where here we have xargs utility arg1 < extraArgs.txt, xargs is going to execute utility, pass arg1 as the first argument and then since we are redirecting the contents of extraArgs.txt to xargs' standard in stream, it will append the arguments after arg1.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.