The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing options to a bash script DeCoTwc Shell Programming and Scripting 3 05-21-2008 02:43 AM
comparing PID values of 2 Files in shell Options marconi Shell Programming and Scripting 2 12-19-2007 01:02 PM
Handeling multiple options in script virus_stinger Shell Programming and Scripting 2 05-23-2006 02:31 PM
Adding -options to shell scripts sysera Shell Programming and Scripting 4 06-21-2005 11:56 AM
Options for csh shell luiz_fer10 UNIX for Dummies Questions & Answers 10 06-03-2002 05:24 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-14-2008
paulobrad paulobrad is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 3
Adding options to a shell script

I want to add options to my shell script but having problems, my code so far is;


Code:
#!/bin/bash
        lflag=
        iflag=
        while getopts 'l:i:' OPTION
        do
          case $OPTION in
          l)    lflag=1
                        lval="$OPTARG"
                        ;;
          i)    iflag=1
                        ival="$OPTARG"
                        ;;
          ?)    printf "Usage: %s: [-a] [-b value] args\n" $(basename $0) >&2
                        exit 2
                        ;;
          esac
        done
shift $(($OPTIND - 1))

When I try to run this with options set I get the error:

Warning: unknown mime-type for "1" -- using "application/*"
Error: no such file "1"


Any ideas? I think my syntax is probably wrong somewhere, thanks.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0