juego de teclas o creaccion de script
Terra 1
torrecollons en terra.es
Lun Nov 12 00:52:58 UTC 2007
En/na Angel J. Chica ha escrit:
> Jonathan De La Torre escribió:
>
>> On Nov 9, 2007 6:45 PM, Jonathan De La Torre <klifffor en gmail.com> wrote:
>>
>>
>>> hola lista.
>>>
>>> sabeis como puedo asignar un comando de terminal a un juego de teclas
>>>
>>> o como crear un script para vajar el nivel del brillo de la pantalla del
>>> portatil
>>>
>>> Brillo del monitor
>>>
>>> 1.- ****** smartdimmer -s 18
>>> 2.- ***** smartdimmer -s 15
>>> 3.- **** smartdimmer -s 11
>>> 4.- *** smartdimmer -s 8
>>> 5.- ** smartdimmer -s 4
>>> 6.- * smartdimmer -s 1
>>>
>>>
>>> saludos
>>> --
>>> klifffor
>>>
>> siguiendo un ejemplo que habia en internet e hecho yo este script cuando lo
>> ejecuto se abre pero no funciona ninguna funcion ni siquiera la de exit
>>
>> ######################
>> #!/bin/bash
>> echo "Selecciona el nivel de brillo"
>> echo " 1.*****"
>> echo " 2.****"
>> echo " 3.***"
>> echo " 4.**"
>> echo " 5.*"
>> echo " 6.Salir"
>>
>> #se elige una de las opciones
>>
>> echo "Opcion:"
>> read opccion
>>
>> #se lee la opcion elegida
>>
>> #se ejecuta segun la opcion elegida. Destacar nombre de la imagen
>>
>> case $opccion in
>> if ["$opccion"= "1"]; then smartdimmer -s 18
>>
>> if ["$opccion"= "2"]; then smartdimmer -s 15
>>
>> if ["$opccion"= "3"]; then smartdimmer -s 12
>>
>> if ["$opccion"= "4"]; then smartdimmer -s 9
>>
>> if ["$opccion"= "5"]; then smartdimmer -s 6
>>
>> if ["$opccion"= "1"]; then exit
>>
>> #FIN
>> #########################
>>
>>
>>
>
> En mi vaío FE31B lo hice así:
> http://mundogeek.net/archivos/2005/05/28/vincular-una-combinacion-de-teclas-a-un-comando-en-gnome/
>
> Salu2.
>
>
>
--
Hola
Yo he tenido problemas en los scripts con el "if", te aconsejo que uses
"case",
y en lugar de un ";" pon dos ";;" al final de la linea te pongo un
ejemplo de un script que uso para conectarme a ordenadores remotos
#!/bin/bash
# Aquest script serveix per conectar als escriptoris remots
# per linia de comanaments se l'hi pasen els arguments per tal de conectarse.
# 1 : Escriptori Remot Informatica a IMTG per Windows
# 2 : Escriptori Remot Oficina a IMTG per Windows
# 3 : Escriptori Remot Informatica a IMTG per Linux
# 4 : Escriptori Remot Oficina a IMTG per Linux
# 5 : Conexio linia de comanaments a SVCN per Linux
# 6 : Escriptori Remot Casal CLN per Windows
# 7 : Escriptori Remot Ajuntament DXS per Windows
# 8 : Escriptori Remot Casal CRM per Windows
# 9 : Escriptori Remot Casal TRRS per Windows
# 10 : Escriptori Remot Casal MSBRD per Windows
# 11 : Escriptori Remot Casal CLN per Windows
opt=$( zenity --list --text "Selecciona una estacio remota" --width 580 --height 440 --radiolist --column "Botons" --column "Numero" --column "Maquina Remota" --hide-column "Numero" TRUE 1 "Escriptori Remot Informatica a IMTG per Windows" FALSE 2 "Escriptori Remot Oficina a IMTG per Windows" FALSE 3 "Escriptori Remot Informatica a
IMTG per Linux" FALSE 4 "Escriptori Remot Oficina a IMTG per Linux" FALSE 5 "Conexio linia de comanaments a SVCN per Linux" FALSE 6 "Escriptori Remot Casal
CLN per Windows" FALSE 7 "Escriptori Remot Ajuntament DXS per Windows" FALSE 8 "Escriptori Remot Casal CRM per Windows" FALSE 9 "Escriptori Remot Casal TRRS per Windows" FALSE 10 "Escriptori Remot Casal MSBRD per Windows" FALSE 11 "Escriptori Remot Casal CLN per Windows" );
# Mirem si s'ha pitjat cancel.lar, si es aixi sortim de l'script
case $? in
"0")
;;
"1")
exit;;
esac
# A continuacio evaluem el valor de la variable opt i actuem en consecuencia amb un CASE
case $opt in
"1")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"2")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"3")
vncviewer xxx.xxx.xxx.xxx:0 -passwd "/home/seglinux/.vnc/passwd";;
"4")
vncviewer xxx.xxx.xxx.xxx:0 -passwd "/home/seglinux/.vnc/passwd";;
"5")
exec /usr/bin/gnome-terminal -x ssh miusuario en xxx.xxx.xxx.xxx -p 00000;;
"6")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"7")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"8")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"9")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"10")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
"11")
rdesktop xxx.xxx.xxx.xxx -u miusuario -p mipassword -a 24 -g 1024x768 -x b -z -P -f -E -k es;;
esac
# Ens asegure'm de sortir de l'script
exit
<http://www.imatge.com/>
Pere
torrecollons en terra.es <mailto:torrecollons en terra.es>
AVIS LEGAL
-------------
LEGAL NOTICE
Confidentiality notice: SERVICASANOVA, S.L. informs you that this
message was sent from its corporate e-mail network. it may include
business and other confidential information protected under the laws of
and other territories. if you are not one of the intended recipients of
the message, you are legally obliged to delete the message content.
Furthermore, you are kindly requested to report immediately the incident
to the sender.
Breach of confidentiality duties is a serious criminal offence in and
other territories. Offenders shall be legally prosecuted worldwide.
Thank you for your cooperation.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://lists.ubuntu.com/archives/ubuntu-es/attachments/20071112/c80e2ed7/attachment.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: Z
Type: image/jpeg
Size: 3634 bytes
Desc: no disponible
URL: <https://lists.ubuntu.com/archives/ubuntu-es/attachments/20071112/c80e2ed7/attachment.jpe>
Más información sobre la lista de distribución ubuntu-es