----according to yoy the envirinment [$1..$2..] will change if i call from the same shell but here it is printing the same values.
The point is not that it has to change, but it might change. You simply cannot rely on the fact that "$1" remains the same before and after getopts - whereas you can rely on, say, "$charley" being the same before and after executing a command.
The meaning of the set-command is simple: "set --" clears the special variables "$1", "$2", etc.:
Therefore the "set -- -2-------" means: first make sure no other commandline parameter is set, regardless of what you enter on the commandline, then set exactly one parameter ("-2") with some argument ("------").
I have a script that facillitates NDM (Connect::\Direct) transfer to remote hosts. This script uses getopts to parse through the parameters passed to it and to set appropriate variables based upon what was passed in.
Kickoff="mv $PATH/$FILE1 $PATH/$FILE2"
ndm_shell.ksh -p $Node -s $Source -d... (3 Replies)
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 have part of the scripts below ,getopt for -h or ? not working for me.
can anybody tell me if this sytax right or wrong.
#!/usr/bin/ksh
program=$(basename $0)
#####################################################################################
function usageerr
{
RC=1
... (3 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)
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)
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)
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)
Discussion started by: SkySmart
4 Replies
LEARN ABOUT REDHAT
modinfo
MODINFO(8) Linux Module Support MODINFO(8)NAME
modinfo - display information about a kernel module
SYNOPSIS
modinfo [ options ] <module_file>
DESCRIPTION
The modinfo utility examines the object file module_file associated with a kernel module and displays any information that it can glean.
OPTIONS
-a, --author
Display the module's author.
-d, --description
Display the module's description.
-fformat_string, --format format_string
Let the user specify an arbitrary format string which can extract values from the ELF section in module_file which contains the mod-
ule information. Replacements consist of a percent sign followed by a tag name in curly braces. A tagname of %{filename} is always
supported, even if the module has no modinfo section. %{kernel_version} shows the version of the kernel the module was compiled
for. %{using_checksums} expands to 1 is the module has versioned symbols and to 0 or <none> otherwise.
A tagname of %{parm} is special: the format string line is repeated for each known module parameter (which may be zero times) and
%{parm} is then replaced by descriptions of module parameters (one parameter on each repeated line).
Alternatively, %a, %d, %l, %n and %p can be used instead of %{author}, %{description}, %{filename}, %{license} and %{parm}, respec-
tively.
-h, --help
Display a summary of options and immediately exit.
-l, --license
Display the module's license.
-n, --filename
Display the module's filename.
-p, --parameters
Display the typed parameters that a module may support.
-V, --version
Display the version of modinfo.
If no options are supplied, the default is filename, description, author, license and parameters.
SEE ALSO insmod(8), modprobe(8), depmod(8), rmmod(8), lsmod(8), ksyms(8), modules(2)Linux March 19, 2002 MODINFO(8)