jQuery in Action, 3rd edition
The moose likes Jython/Python and the fly likes Passing array from shell to python Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Passing array from shell to python" Watch "Passing array from shell to python" New topic

Passing array from shell to python

sharad jain

Joined: May 04, 2013
Posts: 14
Hello friends

I am creating a script where on runtime passing some command line arguments like ::

$./newServerStatus.sh dev_case_01 dev_auth_01 dev_rnp_01 ...

Now I need to use these parameters in a shell and from there this array needs to be passed to a python. Can someone please help me how should I pass and retreive this. Any help would be greatly appreciable.

chris webster

Joined: Mar 01, 2009
Posts: 2290

Not sure how you're calling your Python script, but here's how you can process command-line arguments inside Python:


For passing arguments from a Unix shell script to another process (e.g. Python), there seems to be a special variable "$@" which I think represents all the arguments for the current (Unix) process as separate strings. Some more information here:



No more Blub for me, thank you, Vicar.
I agree. Here's the link: http://aspose.com/file-tools
subject: Passing array from shell to python
It's not a secret anymore!