shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Getopts


From: Ricardo A. Reis
Subject: Re: [shell-script] Getopts
Date: Fri, 19 May 2006 07:35:21 -0300
User-agent: Opera Mail/9.00 (FreeBSD)

On Thu, 18 May 2006 21:54:52 -0300, Fabiano Caixeta Duarte <address@hidden> wrote:

-v -s .... ou -vs ..... ou -s ... -v
-q -s .... ou -vs ..... ou -s ... -q
-v -c .... ou -vc ..... ou -c ... -v
-q -c .... ou -vc ..... ou -c ... -q

Corrigindo o post anterior as opções tem que aceitar os seguintes formatos,

-v -s .... ou -vs ..... ou -s ... -v
-q -s .... ou -qs ..... ou -s ... -q
-v -c .... ou -vc ..... ou -c ... -v
-q -c .... ou -qc ..... ou -c ... -q

Eu ja tinha lido essa url antes, olha oq esta acontecendo;

[ricardo@daemon:/usr/obj] # sh -x /usr/obj/kldfind-v055 -c geom 2>&1 |more
+ kldconfig -r
+ tr ;
+ SEARCH_PATH=/boot/kernel /boot/modules /usr/local/modules
+ EXIT_ERROR=1
+ EXIT_OK=0
+ EXIT_EX_USAGE=64
+ LOCAL_VERSION=0.55
+ [ 2 -eq 0 ]
+ OUT=SHORT
+ getopts hv:q:s:c: OPT
+ [ 2 -eq 1 ]
+ CATEGORY=geom
+ search SHORT c geom   !!!!! a função esta sendo chamada

[ricardo@daemon:/usr/obj] # sh -x /usr/obj/kldfind-v055 -vc geom 2>&1 |more
+ kldconfig -r
+ tr ;
+ SEARCH_PATH=/boot/kernel /boot/modules /usr/local/modules
+ EXIT_ERROR=1
+ EXIT_OK=0
+ EXIT_EX_USAGE=64
+ LOCAL_VERSION=0.55
+ [ 2 -eq 0 ]
+ OUT=SHORT
+ getopts hv:q:s:c: OPT
+ [ 2 -eq 1 ]
+ OUT=VERBOSE
+ getopts hv:q:s:c: OPT

!!! Aqui a variavel $OUT foi declarada novamente, mas o programa exito sem chamar a função!

E se eu mudo a posição do -v

[ricardo@daemon:/usr/obj] # sh -x /usr/obj/kldfind-v055 -c geom 2>&1 -v |more
+ kldconfig -r
+ tr ;
+ SEARCH_PATH=/boot/kernel /boot/modules /usr/local/modules
+ EXIT_ERROR=1
+ EXIT_OK=0
+ EXIT_EX_USAGE=64
+ LOCAL_VERSION=0.55
+ [ 3 -eq 0 ]
+ OUT=SHORT
+ getopts hv:q:s:c: OPT
+ [ 3 -eq 1 ]
+ CATEGORY=geom
+ search SHORT c geom

  A variavel $OUT continua com o seu valor default,



--
Atenciosamente

Ricardo A. Reis
UNIFESP
Unix and Network Adm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]