🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #15917

Re: SCRIPT ELEMENTAL

#15917
From: EstEl
Date: Wed, 31 May 2000 00:00
57 lines
2608 bytes
A ver si puedo decir algo a fserrano@unex.es......
>Saludos
>Mi problema es muy simple, pero por favor no me respondas "man bash"
>porque ese tocho ya lo he visto, y no me aclaro. Estoy intentando el
>equivalente en MSDOS a 
>choice ......
>if errorlevel 1 goto .....
>if errollevel 0 goto .....

Lo siento, pero no me puedo resistir ;)

   case word in [ ( pattern [ | pattern ] ... ) list ;; ] ...
   esac
	  A  case  command  first  expands word, and tries to match it against
	  each pattern in  turn,  using  the same  matching rules as for pathname
	  expansion (see Pathname Expansion below).  When a match is found, the
	  corresponding list is executed.  After the first match, no subsequent
	  matches are attempted.  The exit status is zero if no pattern matches.
	  Otherwise, it is the exit status of the last com� mand executed in
	  list.  

>En bash podr�a usar "dialog --yesno mensaje 0 0" como choice, pero no se
>c�mo redireccionar el script dependiendo de la salida del di�logo. Os
>agradecer�a mucho un simple ejemplo. 


case ho
 in 
  1) <orden> break
     <orden> break
     <orden> break
       .      .
		 .      .
		 .      .   ;;
  2) <orden> break
     <orden> break
     <orden> break
       .      .
		 .      .
		 .      .   ;;
esac

En el DOS el choice lo que hacia es generar una salida de programa con un
numero, aqui simplemente ho puede tomar los valores 1,2,...etc

Para cojer las se�ales tengo por aqui apuntao, trap, pero me tengo que poner
a usarlo por que nunca lo he mirao

Lo de redireccionar segun el dialogo aparte de con el trap (me imagino) se
puede hacer si da un error con 2> (redireccionador de error)

-- 
Este mail esta en.......
(      (     (    (   (  ( ((in Dolby Pro Logic)) )  )   )    )    )      )
                  Enrique(EstEl en irc.unionlatina.org:#berta)
                      Usuario registrado de Linux:140947
Si no se oye la musica configura bien windows y reinicia un par de veces...
Technical Details
Message-ID: <kuf1h8.qc.ln@debian>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.LNX.3.96.1000530093320.6395F-100000@tajo.unex.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,917a58ffc70ec4ec
X-Google-Attributes: gidf86c8,public
From: Enrique@imladris.org (EstEl)
Subject: Re: SCRIPT ELEMENTAL
Date: 2000/05/31
Message-ID: <kuf1h8.qc.ln@debian>
X-Deja-AN: 629177276
Content-Transfer-Encoding: 8bit
References: <Pine.LNX.3.96.1000530093320.6395F-100000@tajo.unex.es>
Content-Type: text/plain; charset=iso-8859-1
Organization: Telefonica Transmision de Datos
Mime-Version: 1.0
User-Agent: slrn/0.9.5.3 (UNIX)
Reply-To: estelANTISPAM@upseros.com
Newsgroups: es.comp.os.linux.programacion