How to make a multi-character parameter in UNIX using getopt? -


i'm trying make getopt command such when pass "-ab" parameter script, script treat -ab single parameter.

#!/bin/sh args=`getopt "ab":fc:d $*` set -- $args in $args case "$i" in         -ab) shift;echo "you typed ab $1.";shift;;         -c) shift;echo "you typed c $1";shift;; esac done 

however, not seem work. can offer assistance?

getopt doesn't support looking for. can either use single-letter (-a) or long options (--long). -ab treated same way -a b: option a argument b. note long options prefixed 2 dashes.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -