wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Passing array from shell to python" Watch "Passing array from shell to python" New topic
Author

Passing array from shell to python

sharad jain
Greenhorn

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.

Thanks
Sharad
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1617
    
  13

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

http://www.tutorialspoint.com/python/python_command_line_arguments.htm

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:

http://www.tutorialspoint.com/unix/unix-special-variables.htm

HTH!


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
 
Similar Threads
Change system variables
passing argument to shell script
Initialization in shell script
Passing sysdate as parameter to Oracle procedure
how to call a servlet from Python?????