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 7705699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:55:41+00:00 2026-05-31T23:55:41+00:00

I am following IBM’s example from their website: (listing #5) http://www.ibm.com/developerworks/library/l-bash-parameters/index.html #!/bin/bash echo OPTIND

  • 0

I am following IBM’s example from their website:

(listing #5) http://www.ibm.com/developerworks/library/l-bash-parameters/index.html

#!/bin/bash
echo "OPTIND starts at $OPTIND"
while getopts ":pq:" optname
  do
    case "$optname" in
      "p")
        echo "Option $optname is specified"
        ;;
      "q")
        echo "Option $optname has value $OPTARG"
        ;;
      "?")
        echo "Unknown option $OPTARG"
        ;;
      ":")
        echo "No argument value for option $OPTARG"
        ;;
      *)
      # Should not occur
        echo "Unknown error while processing options"
        ;;
    esac
    echo "OPTIND is now $OPTIND"
  done

All I want to to is have an option whose name is more than 1 letter. ie -pppp and -qqqq instead of -p and -q.

I have written my program and implementing -help is giving me a problem…

  • 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-05-31T23:55:42+00:00Added an answer on May 31, 2026 at 11:55 pm

    For conventional shell commands, -help is equivalent to -h -e -l -p, so if you parse “-help” with getopts it will treat it as four separate arguments. Because of this you can’t have multi-letter arguments prefixed with only a single hyphen unless you want to do all the parsing yourself. By convention, options that aren’t just single characters (aka “long options”) are preceded by two dashes instead to make things unambiguous.

    The convention for help text is to support both -h and --help.

    Unfortunately bash’s getopts builtin doesn’t support long options, but on all common Linux distributions there’s a separate getopt utility that can be used instead that does support long options.

    There’s more discussion of the topic in this answer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble understanding the following article: http://www.ibm.com/developerworks/java/library/j-jtp01255.html Under, Generics are not covariant
I am using the following http://www.ibm.com/developerworks/opensource/library/x-phpgooglecontact/index.html to authenticate to Google and retrieve a users
I'm following a tutorial on Zend Framework here (http://www.ibm.com/developerworks/opensource/tutorials/os-php-zend2/section2.html). I barely got started, but
I'm looking at a tutorial found on: http://www.ibm.com/developerworks/library/j-dyn0603/ In particular there is a section
As said in the following IBM tutorial, http://public.dhe.ibm.com/software/dw/xml/x-springandroid/x-springandroid-pdf.pdf I have tried to create a
I have the following code: Hashtable env1 = new Hashtable(); env1.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,com.ibm.websphere.naming.WsnInitialContextFactory); log.info(Executed step 1);
My ini file does not have any section. It has following data com.ibm.rcp.toolbox.admin/toolboxvisibleChild=false com.ibm.collaboration.realtime.community/defaultAuthType=ST-DOMINO-SSO
The following screenshow is taken from IBM Heap Analyzer. I want to understand the
I am connecting to a DB2 server using the following code: try { Class.forName(com.ibm.db2.jcc.DB2Driver);
I try to use jboss-seam with a db2 database, the following error occurs com.ibm.db2.jcc.a.SqlException:

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.