double-dash options


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting double-dash options
# 1  
Old 01-10-2007
double-dash options

I need to create a file that accepts arguments and options, and the options have to allow for single-dash options (-abc) and double-dash options (--help). What is the best way to do this? Getopt(s) is great for single-dash, but chokes on double-dash. Do I really need to save the arguments to a file, and use grep?
# 2  
Old 01-10-2007
I'd recommend using perl, and Getopt::Long for this. Else; work on your own implementation around a while loop, case and shift.

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies

2. Shell Programming and Scripting

Exclude dash in grep

Hi, I must be overlooking something, but I don't understand why this doesn't work. I'm trying to grep on a date, excluding all the lines starting with a dash: testfile: #2013-12-31 2013-12-31code: grep '^2013-12-31' testfileI'm expecting to see just the second line '2013-12-31' but I don't... (3 Replies)
Discussion started by: Subbeh
3 Replies

3. Shell Programming and Scripting

Extracting string before first dash in a file name

Hi all, Given a file name such as EXAMPLE=lastname-02.30.71-firstname-town-other.tar.gz How do I print everything before the first dash (i.e. lastname) Note: I do not know exactly how many dashes or what information there will be in each file name so it is important that the code... (2 Replies)
Discussion started by: bashnewbee
2 Replies

4. Shell Programming and Scripting

remove dash

hi I am using ksh #A="abc-def" #typeset -u B="$A" #echo $B ABC-DEF how to remove the dash? i.e. ABCDEF? thank you (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

5. UNIX for Dummies Questions & Answers

awk to seperate a string that has a dash

Hello I have this string XYZ-ABC DFT-ERT QWE-TYU I want to get the part after the dash. how to do that? thanks (2 Replies)
Discussion started by: melanie_pfefer
2 Replies

6. UNIX for Dummies Questions & Answers

ignoring a dash in file name

so i have a simple file called -x and i need it renamed to x now i dont understand why when using the most basic methods, only the code mv ./-x x changes the file name while using any other type of escape characters around the dash, such as single/double quotations or backslash, doesnt. ... (5 Replies)
Discussion started by: LumpSum
5 Replies

7. UNIX for Dummies Questions & Answers

dash after ampersant

Hi! I'm new in these forums and more or less new with Unix. So... here is the question: does anyone know where is redirected the output of a command when you put >&- after it? Does it means any standard file descriptor? Thanks! (2 Replies)
Discussion started by: csecnarf
2 Replies
Login or Register to Ask a Question