10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello everyone,
I need help in understanding the default value for getopts option's argument in ksh. I've written a short test script:
#!/bin/ksh
usage(){
printf "Usage: -v and -m are mandatory\n\n"
}
while getopts ":v#m:" opt; do
case $opt in
v) version="$OPTARG";;
... (1 Reply)
Discussion started by: da1
1 Replies
2. Shell Programming and Scripting
I want to use getopts in ksh scripting to obtain multiple values
currently im using
while getopts vt: opt
do
case "$opt" in
-v) vn=$OPTARG;;
-t) tn="$OPTARG";;
;; # terminate while loop
esac
done
however variables vn tn dont store any... (3 Replies)
Discussion started by: E.sh
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
I am trying to make a Shell Script in KSH on Linux box and Solaris box which takes few arguments... with long options using getopts (not getopt).
I have my sample code... at the end I will say my requirement... Please help me folks...
$ cat dummy
#!/bin/bash
# Argument = -t test -r server... (6 Replies)
Discussion started by: explorer007
6 Replies
5. Shell Programming and Scripting
Hi All,
I would like to improve my bash scripting skill and found a problem which I do not understand. Task is to search and print files in directory (and subdirecories) which contains its own name. Files can have spaces in name.
This one works fine for files in main directory, but not for... (4 Replies)
Discussion started by: new_item
4 Replies
6. Shell Programming and Scripting
Hello,
I've a little problem with one of my ksh scripts and I manage to narrow it to the script here:
#!/bin/ksh
writeLog()
{
paramHandle="unknown"
OPTIND=1
while getopts :i: option $*
do
case $option in
i) paramHandle=${OPTARG} ;;
esac
done
echo... (2 Replies)
Discussion started by: Dahu
2 Replies
7. Shell Programming and Scripting
If I call my function with grouped options: "logm -TDIWEFO 'message' ", then only the "T" gets parsed correctly. The subsequent values returned have underscores prefixed to the value: "_D", "_I", etc. If I "logm -T -DIWEFO 'message' ", the "T" and the "D" are OK, but "I" through "O" get the... (2 Replies)
Discussion started by: kchriste
2 Replies
8. Shell Programming and Scripting
Hello,
I'm writing a script that uses command line options and arguments. To handle these, I'm using getopts. Is there a way to set up an option where an argument is optional?
What I'm trying to do is offer -v for verbose output, -vv for increased output -vvv etc.
Any suggestions?
... (1 Reply)
Discussion started by: garskoci
1 Replies
9. Shell Programming and Scripting
I wrote a script that uses getopts and it works fine. However, I would like to put the function in that script in a startup file (.kshrc or .profile). I took the "main" portion of the script and made it a function in the startup script. I source the startup script but it doesn't seem to parse... (4 Replies)
Discussion started by: lyonsd
4 Replies
10. Shell Programming and Scripting
The profile of the user is empty. Then before I run the script I want I run a parameter file that populates the variables for oracle.
ORACLE_HOME
ORACLE_BASE
ORACLE_SID
PATH
etc ...
But it seems that these variables are not making it to the shell I am in because when I do an echo on... (6 Replies)
Discussion started by: lesstjm
6 Replies