Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:10:51+00:00 2026-06-11T02:10:51+00:00

I am using one shell script to invoke the jython script. When I invoke

  • 0

I am using one shell script to invoke the jython script. When I invoke shell script, I want to pass the arguments which should eventually get passed to jython script.
example command is as following

./passarg.sh -m 12345 -p 'hello'   

the passarg.sh code is as following.

#!/bin/bash
#check whether jython exist or not.
if  which jython >/dev/null; then
    echo " "
else
    echo "Jython does't exist on your system, install it first"
    echo "   Command: sudo apt-get install jython"
    exit 1
fi

# The dependent
export CLASSPATH=.:\
./lib/javaee.jar:\


jython myJythonscript.py  -a  #how to passed arguments to myJythonscript.py

Where as in the jython script I am using getopt to parse the arguments. The myJythonscript.py looks similar to as shown below.

#!/usr/bin/env jython

import unittest
import java
import time
import os
import sys, getopt
def authenticateAccount(verizionAmImp, mdn, password):
    if verizonAMImp.authenticateAccount(mdn, password):
        print mdn, " is registered"
    else:
         print mdn, " is not registered"    
def getRole(verizonAmImp, mdn):
     role = verizonAMImp.getRole(mdn)
     print mdn, " role is ", role

def main():
    URL = "http://localhost:8080/verizon-am-mock/ws/onlinedevice/service"

    password = "verizon0"
    methodCall = 0


    #for Debugging
    print " System Arguments ", sys.argv
    opts, operand = getopt(sys.argv[1:],"ar:m:p:u")

    for o,v in opts:
        if o == "-a":
            methodCall = 1
        elif o == "-r":
            methodCall = 2
        elif o == "-m":
            mdn = v
        elif o == "-p":
            password = v
        elif o == "-u":
            URL = v

    if (mdn is None) or (len(mdn) == 0):
        print "Please provide MDN in the argument"
        exit(1)       

    verizonAMImp = makePortFactory(URL);    

    if methodCall == 1:
        authenticateAccount(verizonAMImp, mdn, password)
    elif methodCall == 2 :    
        getRole(verizonAMImp, mdn)    
    else:
        print "Please check the arguments"
        exit(1) 
if __name__ == '__main__':
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:10:52+00:00Added an answer on June 11, 2026 at 2:10 am

    Same as always.

    ./someprog "$@"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to pass many arguments to a shell script which I don't know
One of the binaries which I am using in my shell script is causing
I am reading one property file which contains some file paths using shell script.
how could we compare lines in two files using a shell script. I want
I am a beginner in using autotool, I want to add some shell script
I m using one EditText field and one spinner. I have to pass teh
I am using one of snook.ca script for simple slideshow. Here it is in
I am using a shell script to execute a series of commends every time
When as part of shell script only one line is operating on a file
I'm creating a shell script to a basic program. One option is to delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.