Sponsored Content
Top Forums Shell Programming and Scripting Getopts with optional parameters Post 303017752 by RudiC on Monday 21st of May 2018 05:54:44 PM
Old 05-21-2018
I don't think any options are mandatory (that's why they're called what they're called). Mandatory existence needs to be taken care of in the case ... esac construct.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getopts takes options for parameters

Here is my post with a question about getopts. I am running korn shell on Solaris 5.8. I am trying to ensure that certain options require a parameter, which is easy enough. I have found that if multiple options are entered on the command line together, but the parameter for one of the options is... (1 Reply)
Discussion started by: UCD-Randy
1 Replies

2. Shell Programming and Scripting

How to make parameters optional?

Hi, I am trying to call a function inside a shell script. Is there a way in which I can make the parameters options in the call? Please help me with this. Thanks!!! (2 Replies)
Discussion started by: neeto
2 Replies

3. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

4. Programming

Parse parameters with getopts

Hi, this is my problem I have script with two parameters -n name and -s surname. Both have arguments and I want to know how parse these parameters with getopts. When you write ./names -n John -s White it find you all persons, which name is John White, but when you write ./names -n John ... (1 Reply)
Discussion started by: frees
1 Replies

5. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

6. Shell Programming and Scripting

getopts - optional and problem to display help

In the below code while getopts :rfw:d:s:a: options do case "$options" in r) echo reverse;; f) echo forward;; w) window=$OPTARG;; d) duration=$OPTARG;; s) search=$OPTARG;; a) value=$OPTARG;; *) help; exit;; esac done ... (2 Replies)
Discussion started by: Amutha
2 Replies

7. Shell Programming and Scripting

Two arguments for optional switch

How to declare the two argument for optional switch ? I have a script that search for a string in current or old zipped log file. Im using a option something like this ${basename} Since $1 can have only one argument should be passed when user select swicth -c and -o need to... (3 Replies)
Discussion started by: baraghun
3 Replies

8. Shell Programming and Scripting

Order of getopts parameters

Hi, Does the order of argument and non-argument command line parameters matter to getopts? with a getopts line in my script of getopts p:cs opt a command line of <script> -p 5 -s only picks up the -p option, while <script> -s -p 5 picks up both. Removing the space between the p and the... (3 Replies)
Discussion started by: rojomoke
3 Replies

9. Red Hat

Linux Optional Packages

Please forgive but I am new to Linux and still learning. When installing Linux (any flavor) over PXE, it asks if you want to customize which packages to install. Most engineers ask us to install all packages but this entails A LOT of clicking. Is there a way to "select all" packages by using a... (3 Replies)
Discussion started by: svolbruck
3 Replies

10. UNIX for Beginners Questions & Answers

Question about getopts optional argument [args...]

There are many places where I can see the syntax description for optargs, which, usually boils down to this: getopts OPTSTRING VARNAME where: OPTSTRING tells getopts which options to expect and where to expect arguments VARNAME tells getopts which shell-variable to use for option reporting... (2 Replies)
Discussion started by: sharkura
2 Replies
TXAWS-DISCOVER(1)						   User Commands						 TXAWS-DISCOVER(1)

NAME
txaws-discover - txAWS AWS API discovery tool SYNOPSIS
txaws-discover [--key KEY] [--secret SECRET] [--endpoint ENDPOINT] DESCRIPTION
Purpose: Invoke an EC2 API method with arbitrary parameters. --action ACTION [PARAMETERS, ...] OPTIONS
--key The AWS access key to use when making the API request. --secret The AWS secret key to use when making the API request. --endpoint The region endpoint to make the API request against. --action The name of the EC2 API to invoke. -h, --help Show help message. Description: The purpose of this program is to aid discovery of the EC2 API. It can run any EC2 API method, with arbitrary parameters. The response received from the backend cloud is printed to the screen, to show exactly what happened in response to the request. The --key, --secret, --end- point and --action command-line arguments are required. If AWS_ENDPOINT, AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY environment variables are defined the corresponding options can be omitted and the values defined in the environment variables will be used. Any additional parameters, beyond those defined above, will be included with the request as method parameters. EXAMPLES
The following examples omit the --key, --secret and --endpoint command-line arguments for brevity. They must be included unless corresponding values are available from the environment. Run the DescribeRegions method, without any optional parameters: txaws-discover --action DescribeRegions Run the DescribeRegions method, with an optional RegionName.0 parameter: txaws-discover --action DescribeRegions --RegionName.0 us-west-1 txaws-discover 0.2.3 May 2012 TXAWS-DISCOVER(1)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy