Sponsored Content
Full Discussion: [BASH] Using getopts
Top Forums Shell Programming and Scripting [BASH] Using getopts Post 302894291 by RudiC on Monday 24th of March 2014 05:27:25 PM
Old 03-24-2014
Your screenshot says: option requires an argument -- l when run with -l only. When supplying -list, l is the option, and ist is the argument.

This is your OPTSTRING: "e:(edit)l:(list)m:(mount)u:(unmount)h:(help)d:(debug)": It has many an option character, some listed twice or even more often, and e, l, m, u, h, and d have a colon next to them, making them require an argument. -d works without arguments as it is listed in "edit" without colon. i should work as well as an option...
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help in getopts

hey need help with getopts again. i am using getopts to read my command line options and arguments. i can manage to do for options that have only one argument e.g srcipt_name -f 3 i am able to use getopts to do this but i am having problems two accept more than two agruments e.g.... (1 Reply)
Discussion started by: problems
1 Replies

2. 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

3. Shell Programming and Scripting

using getopts

Hi, I have a program where I want to use getopts. I want to use "-i" option and then optionally supply arguments. If user dosent supply arguments, then also it should work. Please tell me how to proceed. Here is some code, this is not right code btw but a sample to understand what I want to... (1 Reply)
Discussion started by: som.nitk
1 Replies

4. Shell Programming and Scripting

[bash] getopts not executing when called second time.

Hi, Unexpectedly, the function below doesn't seem to work when called a second time. The output shows that when the function is called the first time, it works as expected but when it is called a second time, the loop that processes the options passed to the function, with the while loop,... (2 Replies)
Discussion started by: ASGR
2 Replies

5. Shell Programming and Scripting

? used in getopts

Suppose I have a code below . while getopts a: opt do case $opt in a) app_name="$OPTARG";; *) echo "$opt is an invalid option"; exit 1;; ?) echo "The value of $OPTARG is an invalid option"; exit 1;; esac done Could anyone please tell me in which case my... (1 Reply)
Discussion started by: maitree
1 Replies

6. Shell Programming and Scripting

bash:getopts command help

How can I say one of the options is required? can I use an if statement? let say: while getopts ":c:u:fp" opt; do case $opt in c) echo "-c was triggered, Parameter: $OPTARG" >&2;; u) echo "-u was triggered, Parameter: $OPTARG" >&2;; f) echo "-u was triggered,... (2 Replies)
Discussion started by: bashily
2 Replies

7. Shell Programming and Scripting

[BASH] getopts, OPTARG is passed but empty

EDIT: -- SOLVED -- Heyas, Getting used to optargs, but by far not understanding it. So i have that script that shall be 'changeable', trying to use the passed arguments to modify the script visuals. Passing: browser -t test -d sect $HOME Where -t should change the title, and -d... (0 Replies)
Discussion started by: sea
0 Replies

8. UNIX for Dummies Questions & Answers

Getopts

while getopts v OPTION do case $OPTION in v) echo "Hello" ;; *) exit 1;; esac done Suppose I have script tmp.sh Whose Signature is tmp.sh <fixed_argument> When I run the script with tmp.sh -v "file", it echoes a hello but, when I try the other way i.e, tmp.sh... (1 Reply)
Discussion started by: Devendra Hupri
1 Replies

9. UNIX for Advanced & Expert Users

[BASH] Getopts/shift within a function, unexpected behaviour

Hello Gurus :) I'm "currently" (for the last ~2weeks) writing a script to build ffmpeg with some features from scratch. This said, there are quite a few features, libs, to be downloaded, compiled and installed, so figured, writing functions for some default tasks might help. Specialy since... (3 Replies)
Discussion started by: sea
3 Replies

10. Shell Programming and Scripting

Getopts help

Hi All, I am writing a script to pass the getopts argument to the function which I have. But it as soon as I execute the script, the argument is taking it as blank. I tried using multiple way to check but its not working. Can someone please let me know what wrong in this code. function1()... (4 Replies)
Discussion started by: sidh_arth85
4 Replies
UMOUNT(8)						    BSD System Manager's Manual 						 UMOUNT(8)

NAME
umount -- unmount file systems SYNOPSIS
umount [-fv] special ... | node ... | fsid ... umount -a | -A [-F fstab] [-fv] [-h host] [-t type] DESCRIPTION
The umount utility calls the unmount(2) system call to remove a file system from the file system tree. The file system can be specified by its special device or remote node (rhost:path), the path to the mount point node or by the file system ID fsid as reported by ``mount -v'' when run by root. The options are as follows: -a All the file systems described in fstab(5) are unmounted. -A All the currently mounted file systems except the root are unmounted. -F fstab Specify the fstab file to use. -f The file system is forcibly unmounted. Active special devices continue to work, but all other files return errors if further accesses are attempted. The root file system cannot be forcibly unmounted. For NFS, a forced dismount can take up to 1 minute or more to complete against an unresponsive server and may throw away data not yet written to the server for this case. -h host Only file systems mounted from the specified host will be unmounted. This option implies the -A option and, unless otherwise speci- fied with the -t option, will only unmount NFS file systems. -t type Is used to indicate the actions should only be taken on file systems of the specified type. More than one type may be specified in a comma separated list. The list of file system types can be prefixed with ``no'' to specify the file system types for which action should not be taken. For example, the umount command: umount -a -t nfs,nullfs unmounts all file systems of the type NFS and NULLFS that are listed in the fstab(5) file. -v Verbose, additional information is printed out as each file system is unmounted. ENVIRONMENT
PATH_FSTAB If the environment variable PATH_FSTAB is set, all operations are performed against the specified file. PATH_FSTAB will not be honored if the process environment or memory address space is considered ``tainted''. (See issetugid(2) for more information.) FILES
/etc/fstab file system table SEE ALSO
unmount(2), fstab(5), autounmountd(8), mount(8) HISTORY
A umount utility appeared in Version 6 AT&T UNIX. BSD
November 22, 2014 BSD
All times are GMT -4. The time now is 11:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy