I need to parse parameters but the arguments could be NULL,example:
> cat getopts.sh
while getopts "a:b:" opt 2>/dev/null
do
case "${opt}" in
a) echo "A:${OPTARG}" ;;
b) echo "B:${OPTARG}" ;;
*) exit 1 ;;
esac
done
> getopts.sh -a TEST1 -b TEST2... (5 Replies)
Hi, I am a new member to unix.com.
Actually I am facing a problem with getopts. In my script i have used getopts to parse the parameters. when i use the script as shown below its working fine:
find_status -p all ### where find_status is a script name.
But even if I pass more than one... (3 Replies)
i was going through the man page of getopts
this particular section is not clear to me can anyone please
clarify in a little detail so that i can understand the concept
MANPAGE::
Since getopts affects the current shell execution environ-
ment, it is generally provided as a... (7 Replies)
How do I get the getopts command to display whats written at my help option if no option is types in? For example,
myscript.sh -h
will bring up my help option, however, I also want
myscript.sh
to do the same!
#!/bin/bash
while getopts :abh opt
do case "$opt" in... (2 Replies)
Hi everyone
I want to know how can we pass multiple argument in getopts
suppose
PARAMS="abcd"
while getopts ${PARMS} FLAG
do
case ${FLAG} in
(a)
(b)
(c)
(d)
esac (6 Replies)
Hi,
I have written a script to take command line arguments using geopts.This is the code.
#!/bin/sh
# The usage of this script.
usage="Usage is $0"
usage="$usage "
usage="$usage "
usage="$usage "
# Use the getopt utility to set up the command line flags.
set -- `/usr/bin/getopt... (4 Replies)
can anyone spot a problem with the below:
$
$ cat getopts.sh
#!/bin/sh
usage() { echo "myscript.sh local /tmp data.txt 600s -query" 1>&2; exit 1; }
while... (4 Replies)
Hi Unix Gurus,
i am on learning path of unix, and yet to discover many things. I came across with this requirement where i need to pass parameters but the position of parameters is not fixed so after doing some google search got to know "getopts" can handle that. So here is my code:
function... (3 Replies)
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
LEARN ABOUT OPENSOLARIS
noecho
echo(3XCURSES) X/Open Curses Library Functions echo(3XCURSES)NAME
echo, noecho - enable/disable terminal echo
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int echo(void);
int noecho(void);
DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially,
curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft-
ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined.
RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR.
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5)SunOS 5.11 5 Jun 2002 echo(3XCURSES)