• Blogs
  • Foro
  • Chat
  • Libros
  • LoCos
  • Agregador
Costa Rica LoCoTeam

The next version of Ubuntu is coming soon

Buscar

Encuesta

¿Al guien sabe la equibalencia del programa autoplay-media-studio para linux ?
corealuis_406@hotmail.com
0%
porfa
100%
Total votes: 1
  • Añadir nuevo comentario
  • 18 lecturas
  • Encuestas anteriores

Inicio de sesión

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Crear cuenta nueva
  • Solicitar nueva contraseña

Navegación

  • Envíos recientes
  • Consejos para composición
  • Encuestas

Temas nuevos

  • Stickers de Ubuntu
  • Lineas de Colores - Dell Inspiron 1501
  • Buuuuuuuuuuenas!
more

Comentarios recientes

  • lastima que leden tampoco tiempo alos reocitorios
    hace 4 semanas 3 días
  • Probado en kubuntu 11.10 y
    hace 5 semanas 3 días
  • java plugin en kubuntu 11.04
    hace 23 semanas 1 hora
  • Curso Linux 2011 Veracruz-México
    hace 43 semanas 3 días
  • problema Efectos compiz en 10.04
    hace 1 año 2 semanas
  • Podés comprar desde la tienda
    hace 1 año 6 semanas
  • Espero q te ayude
    hace 1 año 6 semanas
  • Busca en ebay los chinitos te
    hace 1 año 32 semanas
  • Instalar VirtualBox OSE
    hace 1 año 35 semanas
  • es fácil. Aplicaciones /
    hace 1 año 36 semanas

Dialog

Submitted by smemrobo on Mié, 11/07/2007 - 22:00
  • Desarrollo/Programación

Estuve "programando" con Dialog y me salieron varios scripts. Aqui van...

‹ Editor de PHP para Ubuntu Netbeans y Beryl o cualquier aplicación Java que no funcione ›
  • Añadir nuevo comentario
  • 406 lecturas

Este ultimo, si por fin el

Submitted by smemrobo on Jue, 12/07/2007 - 14:57.

Este ultimo, si por fin el ultimo, me dio muchos dolores de cabeza, pues la barra de progreso no me hacia caso, me jacto de que averigué todo yo solito... los otros... tambien!!! ja ja ja. Aun asi, me estorba en la mente, que sale un error y me hecha a perder todo el entorno, cuando lo corran lo van a ver... (si es que alguien lee este post), si hace el backup, calcula tambien el progreso por archivo, pero tira un error de ELIMINANDO / DE LOS NOMBRES... que es eso??? nunca lo entendi... y me dio pereza mental...

Ahi va, suerte y chao hasta la proxima:

#!/bin/bash
: ${DIALOG=dialog}

cd /home

for archivo in $( ls ); do
let contador=contador+1
done
echo $contador

let parte=100/$contador

PCT=0
(
for archivo in $( ls ); do
PCT=`expr $PCT + $parte`
echo "XXX"
echo $PCT
echo "Procesando el usuario: $archivo"
echo "XXX"
sleep 1
tar -cf /mnt/respaldo/backup$(date +%Y%m%d)_$archivo.tar /home/$archivo/
done
) |

$DIALOG --title "LinuxMania" --gauge "Hi, this is a gauge widget" 20 70 0

============================================================
la linea anterior para adelante son otra cosa
les posteo tambien un archivo para que no tengan que escribir, y para que le cambien el nombre, lo copien y borre, lo van a necesitar para el sort de los ejercicios:

Linux
tux
vi
vim
gnu
enlightenment
KDE
Debian
gnome
afterstep
Openoffice
c
wine
man
red hat
fedora
mandriva
suse
Ubuntu
=================================================
la linea anterior y para adelante, no las copien... burros
Gracias... eso jue todo.

Albert Einstein dijo:

No existe alguien ignorante, lo que pasa es que no todos sabemos lo mismo...

  • responder

jjajajajajajaj mae Esteban

Submitted by car1584 on Sáb, 22/09/2007 - 14:57.

jjajajajajajaj mae Esteban que bueno.

  • responder

Este creo que no incorpora

Submitted by smemrobo on Jue, 12/07/2007 - 14:56.

Este creo que no incorpora nuevo, pero igual lo incluyo para que lo paste+copy... me encanta programar...

#!/bin/bash
: ${DIALOG=dialog}

finalizar=0
while [ finalizar != 1 ]; do
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--ok-label "Choose" \
--cancel-label "Exit" \
--menu "Choose one option:" \
12 60 5 \
"1" "Display the number of lines of a file" \
"2" "Delete a wanted file" \
"3" "Rename a wanted file" \
"4" "Check if a file exists" \
"0" "Exit" 2> $tempfile
retval=$?
if [ $retval = 1 ]; then exit
fi
opcion=`cat $tempfile`
case $opcion in
1) tempfile1=`tempfile1 2>/dev/null` || tempfile1=/tmp/test$$
trap "rm -f $tempfile1" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the file do you want see:" \
5 50 2> $tempfile1
file1=`cat $tempfile1`
tempfile2=`tempfile2 2>/dev/null` || tempfile2=/tmp/test$$
trap "rm -f $tempfile2" 0 1 2 5 15
cat -n $file1 > $tempfile2
$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--exit-label "Exit" \
--textbox "$tempfile2" 22 77
;;
2) tempfile3=`tempfile3 2>/dev/null` || tempfile3=/tmp/test$$
trap "rm -f $tempfile3" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the file do you want delete:" \
5 50 2> $tempfile3
file2=`cat $tempfile3`
rm -i $file2
;;
3) tempfile4=`tempfile4 2>/dev/null` || tempfile4=/tmp/test$$
trap "rm -f $tempfile4" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the file do you want rename:" \
5 50 2> $tempfile4
file3=`cat $tempfile4`
tempfile5=`tempfile5 2>/dev/null` || tempfile5=/tmp/test$$
trap "rm -f $tempfile5" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Four" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the new name of the file:" \
5 50 2> $tempfile5
file4=`cat $tempfile5`
mv $file3 $file4
;;
4) exec 3>&1
file4=`$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--backtitle "Work One" \
--form "LinuxMania -- Remember write the full path" \
10 50 0 \
"Write the filename: " 1 1 "" 1 20 25 0 \
2>&1 1>&3`
if [ -f $file4 ]
then
$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--title "Message" \
--msgbox "The File Exist" 5 25
else
$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--title "Message" \
--msgbox "The File Dont Exist" 5 25
fi
;;
0) exit
;;
esac
done

  • responder

Yo soy programador empirico,

Submitted by smemrobo on Jue, 12/07/2007 - 14:55.

Yo soy programador empirico, asi que si encuentran errores de programación me dicen... y no es eso de que falta una x... si no por ejemplo que nunca repeti variables, por que no sabia si iba a dar algun error... tampoco me queda muy claro lo de las salidas standard... pero me la jugue y las pude usar:

En la ultima opción, esta lo que les decia de desviar la salida en pantalla para tirar a dialog...

#!/bin/bash
: ${DIALOG=dialog}

finalizar=0
while [ finalizar != 1 ]; do
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Choose" \
--cancel-label "Exit" \
--menu "Choose one option:" \
10 60 4 \
"1" "Display the files of the wanted directory" \
"2" "Search a file" \
"3" "Find a file" \
"0" "Exit" 2> $tempfile
retval=$?
if [ $retval = 1 ]; then exit
fi
opcion=`cat $tempfile`
case $opcion in
1) tempfile1=`tempfile1 2>/dev/null` || tempfile1=/tmp/test$$
trap "rm -f $tempfile1" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the directory do you want see" \
5 50 2> $tempfile1
directory=`cat $tempfile1`
if [ -d $directory ]; then
ls -l --color $directory | more
else
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Accept" \
--cancel-label "Return" \
--msgbox "This isnt a directory" 5 27
fi
;;
2) tempfile2=`tempfile2 2>/dev/null` || tempfile2=/tmp/test$$
trap "rm -f $tempfile2" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the name of the file do want I display:" \
5 50 2> $tempfile2
file1=`cat $tempfile2`
tempfile3=`tempfile3 2>/dev/null` || tempfile3=/tmp/test$$
trap "rm -f $tempfile3" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the directory where do you want begins to search:" \
10 50 2> $tempfile3
directory1=`cat $tempfile3`
find $directory1 -name $file1 | less
;;
3) tempfile4=`tempfile4 2>/dev/null` || tempfile4=/tmp/test$$
trap "rm -f $tempfile4" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the path and the name of the file do you want sort:" \
10 50 2> $tempfile4
file2=`cat $tempfile4`
tempfile5=`tempfile5 2>/dev/null` || tempfile5=/tmp/test$$
trap "rm -f $tempfile5" 0 1 2 5 15
sort $file2 > $tempfile5
$DIALOG --title "LinuxMania" \
--backtitle "Work Three" \
--exit-label "Exit" \
--textbox "$tempfile5" 22 77
;;
0) exit ;;
esac
done
clear
echo "Hecho por Esteban Monge Marín. San Jose, Costa Rica. Tel:3672009. 2007"

  • responder

La cosa se pone mejor, este

Submitted by smemrobo on Jue, 12/07/2007 - 14:55.

La cosa se pone mejor, este incorpora menus:

Ademas dialog incluye calendarios..., en todo caso tambien puse desplegar el año con cal... podemos desviar la salida de cal para que salga directamente al cuadro de dialog... pero, como podran ver mas adelante

#!/bin/bash
: ${DIALOG=dialog}

finalizar=0
while [ finalizar != 1 ]; do
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --title "LinuxMania" \
--backtitle "Work Two" \
--ok-label "Choose" \
--cancel-label "Exit" \
--menu "Choose one option:" \
10 60 4 \
"1" "Display the actual month" \
"2" "Display the wanted month of the actual year" \
"3" "Display the wanted year" \
"0" "Exit" 2> $tempfile
retval=$?
if [ $retval = 1 ]; then exit
fi
opcion=`cat $tempfile`
case $opcion in
1) tempfile2=`tempfile2 2>/dev/null` || tempfile2=/tmp/test$$
trap "rm -f $tempfile2" 0 1 2 5 15
date +%m > $tempfile2
mes=`cat $tempfile2`
tempfile3=`tempfile3 2>/dev/null` || tempfile3=/tmp/test$$
trap "rm -f $tempfile3" 0 1 2 5 15
date +%Y > $tempfile3
ano=`cat $tempfile3`
$DIALOG --title "LinuxMania" \
--backtitle "Work Two" \
--ok-label "OK" \
--cancel-label "Return" \
--calendar "" 0 0 1 $mes $ano
clear ;;
2) tempfile4=`tempfile4 2>/dev/null` || tempfile4=/tmp/test$$
trap "rm -f $tempfile4" 0 1 2 5 15
$DIALOG --title "LinuxMania" \
--backtitle "Work Two" \
--ok-label "Accept" \
--cancel-label "Return" \
--inputbox "Type the month wanted of this year" \
5 50 2> $tempfile4
clear
meses=`cat $tempfile4`
tempfile5=`tempfile5 2>/dev/null` || tempfile5=/tmp/test$$
trap "rm -f $tempfile5" 0 1 2 5 15
date +%Y > $tempfile5
ano2=`cat $tempfile5`
$DIALOG --title "LinuxMania" \
--backtitle "Work Two" \
--ok-label "OK" \
--cancel-label "Return" \
--calendar "" 0 0 1 $meses $ano2
clear ;;
3) cal -y | less ;;
0) exit
finalizar=1 ;;
esac
done
clear
echo "Hecho por Esteban Monge Marín. Tel: 3672009. 2007. San Jose. Costa Rica"

  • responder

Aunque en Ubuntu no se pueda

Submitted by smemrobo on Jue, 12/07/2007 - 14:54.

Aunque en Ubuntu no se pueda programar bien en Dialog, en cambio recomiendo que en Debian si lo hagan... ya que hay que configurar bien el idioma de la consola, algo que en Ubuntu dejan de lado...

en ubuntu, tienen que conseguir con apt-get install dialog... en debian... Tambien ja ja ja

Son muy básicos, y el ultimo que hace Backups, da un error en la barra de progreso, si puedo solucionarlo, lo hago:

En este nos pide que le demos la direccion de un archivo, si este se encuentra, entonces le pide un nuevo nombre para cambiarlo... muy básico pero instructivo...

#!/bin/bash
# Fecha 07/07/07. Hora: 01:48am
: ${DIALOG=dialog}

exec 3>&1
ARCHIVO=`$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--backtitle "Work One" \
--form "LinuxMania -- Remember write the full path" \
10 50 0 \
"Write the filename: " 1 1 "" 1 20 25 0 \
2>&1 1>&3`
returncode=$?
case $returncode in
1) exit ;;

0) if [ -f $ARCHIVO ]
then
exec 3>&1
NEWNAME=`$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--backtitle "Work One" \
--form "LinuxMania -- Remember write the full path" \
10 50 0 \
"Write the new filename: " 1 1 "" 1 24 25 0 \
2>&1 1>&3`
returncode=$?
case $returncode in
1) exit ;;
0) mv $ARCHIVO $NEWNAME ;;
esac
else
$DIALOG --ok-label "Accept" \
--cancel-label "Deny" \
--title "Message" \
--msgbox "The File Dont Exist" 5 25
fi;;
esac
clear
echo "Hecho por Esteban Monge Marín. Tel: 3672009. San Jose Costa Rica. 2007"

  • responder
El contenido de este sitio web está liberado bajo la licencia Creative Commons Atribución 3.0, a menos que se especifique lo contrario.