Sponsored Content
Top Forums Shell Programming and Scripting Usage: optional and mandatory arguments Post 302572533 by kristinu on Thursday 10th of November 2011 08:35:23 AM
Old 11-10-2011
Usage: optional and mandatory arguments

I have an awk script which can be used in the following ways:

xi and xf will only be mandatory when processing the file fin.zc.

Code:
awk -v xi=0/-0.5 -v xf=80/30 -f ./zc2cmd.awk fin.zc > fout.cmod
awk -f ./zc2cmd.awk -u
awk -f ./zc2cmd.awk --usg
awk -f ./zc2cmd.awk -e
awk -f ./zc2cmd.awk -examples
awk -f ./zc2cmd.awk -h
awk -f ./zc2cmd.awk -help

I have tried the below, but does not describe all the ways to use it, and might be confusing.

Basically I use

Code:
awk [mandatoryArgs] -f ./zc2cmd.awk fin > fout
awk -f ./zc2cmd.awk [optionalArgs]

Code:
  print "  awk [mandatoryArgs] -f ./zc2cmd.awk fin > fout"
  print "  awk -f ./zc2cmd.awk [optionalArgs]"
  print ""
  print "--Mandatory Arguments--------------------------------------------------"
  print ""
  print "  -v xi=xix/xiz     Top left corner of the model."
  print "  -v xf=xfx/xfz     Bottom right corner of the model."
  print "  fin               Input sound speed profile (.zc) file."
  print "  fout              Output sound speed (.cmd) file."
  print ""
  print "--Optional Arguments--------------------------------------------------"
  print ""
  print "  -h, --help, -u, --usage, -e, --examples"
  print "                    Prints a usage message."


Last edited by kristinu; 11-10-2011 at 10:42 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Mandatory fileds in Bugzilla

Hi, We need to configure some of the fileds in bugzilla like Platform,OS, Version etc are mandatory. Is it possible to set, if yes then how to configure. Thanks & Regards, Bache (0 Replies)
Discussion started by: bache_gowda
0 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

4. 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

5. 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

6. Shell Programming and Scripting

How to make shell script arguments optional?

Here is my script: #!/bin/ksh usage () { echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>" } if ; then usage exit; fi prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Discussion started by: guitarscn
8 Replies

7. AIX

Mandatory FS for mksysb

Hi all, my first post. Be kind to me and to my english writing (i'm french) :) During mksysb backup, some files are moving. I don't know yet which files (i'm starting a new job). For now, i'm wondering which fs are mandatory for a mksysb backup. Currently, hereafter the content of rootvg :... (5 Replies)
Discussion started by: Fundix
5 Replies

8. Shell Programming and Scripting

Arguments in usage statement

Hello, I have a question regarding the usage statement of a script. I have 2 parameters "--pto" and "--pto_list". To start the script I will need one of them. Both together are not possible. How this would be printed out within a usage statement? My suggestion would be: Usage:... (4 Replies)
Discussion started by: API
4 Replies

9. Shell Programming and Scripting

Bash shell script with mandatory and optional input

Hello I would like to write a bash shell script which will need user to supply one variable which is mandatory and some other optional variables. If mandatory variable is not supplied by user, the script will exit. If optional values are not supplied by user, hard-coded value (in the script)... (3 Replies)
Discussion started by: atanubanerji
3 Replies
FusionInventory::Agent::Storage(3pm)			User Contributed Perl Documentation		      FusionInventory::Agent::Storage(3pm)

NAME
FusionInventory::Agent::Storage - A data serializer/deserializer SYNOPSIS
my $storage = FusionInventory::Agent::Storage->new( directory => '/tmp' ); my $data = $storage->restore( module => "FusionInventory::Agent" ); $data->{foo} = 'bar'; $storage->save(data => $data); DESCRIPTION
This is the object used by the agent to ensure data persistancy between invocations. Each data structure is saved in a file, whose name is automatically determined according to object class name. An optional index number can be used to differentiate between consecutives usages. METHODS
new(%params) The constructor. The following parameters are allowed, as keys of the %params hash: logger the logger object to use directory the directory to use for storing data (mandatory) getDirectory Returns the underlying directory for this storage. has(%params) Returns true if a saved data structure exists. The following arguments are allowed: name The file name to use for saving the data structure (mandatory). save(%params) Save given data structure. The following parameters are allowed, as keys of the %params hash: name The file name to use for saving the data structure (mandatory). restore(%params) Restore a saved data structure. The following parameters are allowed, as keys of the %params hash: name The file name to use for saving the data structure (mandatory). remove(%params) Delete the file containing a seralized data structure for a given module. The following parameters are allowed, as keys of the %params hash: name The file name to use for saving the data structure (mandatory). perl v5.14.2 2012-06-14 FusionInventory::Agent::Storage(3pm)
All times are GMT -4. The time now is 03:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy