English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am writing a command for users. When checking the options ( -f -i or -fi for example) I don't want to use a serious of if statements or a long case-switch program. Does anyone have any idea how to read these options in?

2006-10-12 23:10:06 · 3 answers · asked by Appy 1 in Computers & Internet Programming & Design

3 answers

Are you looking for something like getopts for example:

-f -i

while getopts f:i opt
do
case "$opt" in
f) ;;
i) ;;
esac
done

Is that what you have in mind?

2006-10-12 23:32:08 · answer #1 · answered by eternalvoid 3 · 2 0

I am at the same quandry... Isn't there a module that shows us something here... perhaps on the C language forum/wiki?

I don't know too many yahooligans who even know what a command is, much less, how to obey one!

2006-10-12 23:14:30 · answer #2 · answered by Anonymous · 0 1

take the options as comand line and check for arg 0 arg1 arg2

2006-10-12 23:13:14 · answer #3 · answered by irfan 2 · 1 0

fedest.com, questions and answers