10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to capture space as well from the argument
eg:
script.ksh -m "Message from xyz" -e "email@xyz.com"
script.ksh -m 'Message from xyz' -e 'email@xyz.com'
I am parsing using getopts, but for option "m" OPTARG is returning only "Message".
Please use code tags next time for... (9 Replies)
Discussion started by: tostay2003
9 Replies
2. Shell Programming and Scripting
Hello,
I am using below code in AIX env to interpret -n option given in argument while executing the script .I want to give another argument -t
#!/bin/sh
#set -x
while getopts ":n:" opt; do
case "$opt" in
n)
host=$OPTARG
shift 2
;;
*)... (3 Replies)
Discussion started by: Vishal_dba
3 Replies
3. Shell Programming and Scripting
I use the "getopts" ksh built-in to handle command-line options, and I'm looking for a clean/standard way to "unset" an option on the command line. I don't know if this is a technical question about getopts or more of a style/standards question. Anyway, I understand that getopts processes its... (4 Replies)
Discussion started by: Matt Miller
4 Replies
4. Shell Programming and Scripting
hi, here is a ksh script i wrote using getopts...
i want to find out how i can run it in default mode when no option is mentioned and no arguments are provided... ?
i.e if the script name is final1, then just running final1 should run in default mode....
while getopts 1:2:3:4: mode ... (1 Reply)
Discussion started by: pravsripad
1 Replies
5. Shell Programming and Scripting
Hi Gurus
I am trying to figure out (with not much success) how to pass two values to a single getopts argument ... for example
./script -a Tuesday sausagesThe $OPTARG variable seems to only get populated with the first argument. What im looking to do is to process the first argument (i.e.make... (6 Replies)
Discussion started by: rethink
6 Replies
6. Shell Programming and Scripting
Hello,
Does getopts have some way of handling the use of an option that requires a parameter more than once on the command line.
e.g. mycmd -a john -a jane
I came up with a solution using arrays (shown below), but wonder if getopts has some other way of handling it. Other solutions... (2 Replies)
Discussion started by: CarlosNC
2 Replies
7. Shell Programming and Scripting
Hi,
I have a script that ran perfectly on Solaris 5.8
However after upgrade to Solaris 5.10 it started failing.
I invoke the script as below:
./TestScript3.ksh --dir $APP_DATA_IN_OLD $NDM_DATA/$NEXT_FILE
When i execute it i get the following error "getopts: dir bad option(s)".
Please let... (1 Reply)
Discussion started by: JoeJoseph
1 Replies
8. Shell Programming and Scripting
Hello everyone,
Is it possible to use getopts and also receive arguments without option flags?
e.g. myscript arg1 arg2 -a arg3 -b arg4
If so, how do you stop getopts from exiting as soon as it detects the non-option arguments? (2 Replies)
Discussion started by: kdelok
2 Replies
9. Shell Programming and Scripting
Hi,
I'm using bash and ksh93 compatible derivatives.
In a recent getopts experience, I found myself spending far too much
time on this little problem. I hope someone can help...
So here's the deal.
I want to build have a command line interface that accepts either zero,
one, or... (4 Replies)
Discussion started by: duderonomy
4 Replies
10. Shell Programming and Scripting
Hi all,
I am parsing command line options using getopts.
The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument.
Below is the script:
while getopts :hd:t:s:l:p:f: opt
do
case "$opt" in
-h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies