Sponsored Content
Full Discussion: getopts problem
Top Forums UNIX for Advanced & Expert Users getopts problem Post 302257401 by mobydick on Wednesday 12th of November 2008 04:34:12 AM
Old 11-12-2008
getopts issue

in the below script i am expecting the variable surname to be changed but that is not happening can anyone help and explain why and how to do that


surname=halder

echo $surname

while getopts "Smilie" OPTION
do
case $OPTION in

b) surname=bose
;;

esac
done

echo $surname
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getopts

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)
Discussion started by: google
3 Replies

2. Shell Programming and Scripting

Problem with getopts

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)
Discussion started by: Klashxx
5 Replies

3. Shell Programming and Scripting

getopts help

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)
Discussion started by: GrepMe
3 Replies

4. Shell Programming and Scripting

Problem in getopts

while getopts l:f:s:o:h: c do case $c in l) tail -${OPTARG} /etc/passwd exit 2;; f) head -${OPTARG} /etc/passwd exit 3;; s) grep ${OPTARG} /etc/passwd | cut -d: -f7 exit 4;; o) OARG=$OPTARG exit 5;; h) ... (3 Replies)
Discussion started by: nadman123
3 Replies

5. Shell Programming and Scripting

problem with getopts

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)
Discussion started by: pvamsikr
3 Replies

6. Shell Programming and Scripting

getopts problem

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)
Discussion started by: linuxkid
2 Replies

7. Shell Programming and Scripting

getopts problem

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)
Discussion started by: aishsimplesweet
6 Replies

8. Shell Programming and Scripting

getopts - optional and problem to display help

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)
Discussion started by: Amutha
2 Replies

9. Shell Programming and Scripting

problem with getopts

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)
Discussion started by: arijitsaha
4 Replies

10. Shell Programming and Scripting

Identify problem with while getopts

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
QSqlIndex(3qt)															    QSqlIndex(3qt)

NAME
QSqlIndex - Functions to manipulate and describe QSqlCursor and QSqlDatabase indexes SYNOPSIS
#include <qsqlindex.h> Inherits QSqlRecord. Public Members QSqlIndex ( const QString & cursorname = QString::null, const QString & name = QString::null ) QSqlIndex ( const QSqlIndex & other ) ~QSqlIndex () QSqlIndex & operator= ( const QSqlIndex & other ) virtual void setCursorName ( const QString & cursorName ) QString cursorName () const virtual void setName ( const QString & name ) QString name () const virtual void append ( const QSqlField & field ) virtual void append ( const QSqlField & field, bool desc ) bool isDescending ( int i ) const virtual void setDescending ( int i, bool desc ) Static Public Members QSqlIndex fromStringList ( const QStringList & l, const QSqlCursor * cursor ) DESCRIPTION
The QSqlIndex class provides functions to manipulate and describe QSqlCursor and QSqlDatabase indexes. This class is used to describe and manipulate QSqlCursor and QSqlDatabase indexes. An index refers to a single table or view in a database. Information about the fields that comprise the index can be used to generate SQL statements, or to affect the behavior of a QSqlCursor object. Normally, QSqlIndex objects are created by QSqlDatabase or QSqlCursor. See also Database Classes. MEMBER FUNCTION DOCUMENTATION
QSqlIndex::QSqlIndex ( const QString & cursorname = QString::null, const QString & name = QString::null ) Constructs an empty index using the cursor name cursorname and index name name. QSqlIndex::QSqlIndex ( const QSqlIndex & other ) Constructs a copy of other. QSqlIndex::~QSqlIndex () Destroys the object and frees any allocated resources. void QSqlIndex::append ( const QSqlField & field ) [virtual] Appends the field field to the list of indexed fields. The field is appended with an ascending sort order. Reimplemented from QSqlRecord. void QSqlIndex::append ( const QSqlField & field, bool desc ) [virtual] This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Appends the field field to the list of indexed fields. The field is appended with an ascending sort order, unless desc is TRUE. QString QSqlIndex::cursorName () const Returns the name of the cursor which the index is associated with. QSqlIndex QSqlIndex::fromStringList ( const QStringList & l, const QSqlCursor * cursor ) [static] Returns an index based on the field descriptions in l and the cursor cursor. The field descriptions should be in the same format that toStringList() produces, for example, a surname field in the people table might be in one of these forms: "surname"," surname DESC" or "people.surname ASC". See also toStringList(). bool QSqlIndex::isDescending ( int i ) const Returns TRUE if field i in the index is sorted in descending order; otherwise returns FALSE. QString QSqlIndex::name () const Returns the name of the index. QSqlIndex &; QSqlIndex::operator= ( const QSqlIndex & other ) Sets the index equal to other. void QSqlIndex::setCursorName ( const QString & cursorName ) [virtual] Sets the name of the cursor that the index is associated with to cursorName. void QSqlIndex::setDescending ( int i, bool desc ) [virtual] If desc is TRUE, field i is sorted in descending order. Otherwise, field i is sorted in ascending order (the default). If the field does not exist, nothing happens. void QSqlIndex::setName ( const QString & name ) [virtual] Sets the name of the index to name. SEE ALSO
http://doc.trolltech.com/qsqlindex.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsqlindex.3qt) and the Qt version (3.3.8). Trolltech AS 2 February 2007 QSqlIndex(3qt)
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy