Usage: optional and mandatory arguments


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Usage: optional and mandatory arguments
# 1  
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..
# 2  
Old 11-11-2011
... and your question is?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

9. 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
Login or Register to Ask a Question