C언어

getopt long type

고요한하늘... 2011. 6. 24. 16:35

http://www.missiondata.com/blog/system-administration/17/17/



set -- `getopt -n$0 -u -a --longoptions="depth: adddays: topN:" "h" "$@"` || usage
[ $# -eq 0 ] && usage
while [ $# -gt 0 ]
do
    case "$1" in
       --depth)   depth=$2;shift;;
       --adddays) adddays=$2;shift;;
       --topN)    topN=$2;shift;;
       -h)        usage;;
       --)        shift;break;;
       -*)        usage;;
       *)         break;;            #better be the crawl directory
    esac
    shift
done

'C언어' 카테고리의 다른 글

sort ( 파일 내부 엔트리 )  (0) 2011.08.29
curl  (0) 2011.08.16
TCP/IP accept() Interrupted system call   (0) 2011.05.03
Google CPU Profiler  (0) 2010.08.30
strncpy vs memcpy  (0) 2010.08.27