Agenda simples em Dialog

Publicado por Daniel Lara Souza (última atualização em 07/02/2012)

[ Hits: 9.495 ]

Homepage: http://danniel-lara.blogspot.com/

Download 5189.agenda.sh

Download agendav2.sh (versão 2)




Uma agenda simples, que solicita nome e telefone em dialog.

  



Versões atualizadas deste script

Versão 2 - Enviado por Daniel Lara Souza em 03/02/2012

Changelog: Adualizado para o Yad
#!/bin/bash
#
# Agenda Simples em Yad
# Autor: Daniel Lara Souza
# Versao 0.2
# Migrado do Dialog para o Yad
# Ajuda do rai3mb ( Raimundo Alves Portela )
# na Criação do Menu

while : ; do
OPCAO=$( \
yad --list \
--title=' AGENDA ' --text='Escolha um opcao: ' \
--width=400 --height=200 \
--column='opcao':NUM --column='texto':TEXT \
--no-headers --print-column=1 --separator='' --hide-column=1 \
1 'Adicionar Contato' \
2 'Listar Contatos' \
3 'Pesquisar Contatos ' \
4 'Deletar Contatos' \
--button="Sair":1 --button="Acessar":0 )


[ $? -ne 0 ] && break

case "$OPCAO" in


1)
NOME=$( yad --entry --entry-label="Nome" --entry-text="")

FONE=$( yad --entry --entry-label="Telefone" --entry-text="")

echo $NOME - $FONE >> agenda;

;;
2) sort agenda > agenda.tmp

AGENDA=$(cat agenda.tmp)

yad --title="Agenda" --text="$AGENDA" --width="300" --height="100"

rm -rf agenda.tmp
;;

3) nome=$( yad --entry --entry-label="Nome" --entry-text="" )

AGENDA=$(cat agenda | grep $nome)

yad --title="Agenda" --text="$AGENDA" --width="300" --height="100"


;;

4) nome=$( yad --entry --entry-label="Nome" --entry-text="" )

mv agenda agenda.tmp

grep -v $nome agenda.tmp > agenda

rm -rf agenda.tmp
;;

0) break

;;
esac
done

Download agendav2.sh


Esconder código-fonte

#!/bin/bash
#
#   Agenda Simples em Dialog
#   Autor: Daniel Lara Souza
#   Versao 0.1
while : ; do
 reposta=$(
    dialog --stdout               \
           --title     ' AGENDA  ' \
           --menu    'Escolha um opcao: ' \
           0 0 0            \
           1 'Adicionar Contato'   \
           2 'Listar Contatos'  \
           3 'Pesquisar Contatos ' \
           4 'Deletar Contatos'       \
           0 'Sair'      \
                   )        
   [ $? -ne 0 ] && break
  
   case "$reposta" in
           
           1) nome=$( dialog --stdout --inputbox 'Digite o nome:' 0 0 )
           
              fone=$( dialog --stdout --inputbox 'Digite o Telefone:' 0 0 )
           
              echo $nome - $fone >> agenda;
           ;;
        
           2)  sort agenda > agenda.tmp 
               
               dialog --textbox agenda.tmp 0 0
               
               rm -rf agenda.tmp
           ;;
        
           3)  nome=$( dialog --stdout --inputbox 'Digite o nome:' 0 0 )
               
               cat agenda | grep $nome > agenda.tmp
               
               dialog --textbox agenda.tmp 0 0

               rm -rf agenda.tmp
           ;;
        
           4) nome=$( dialog --stdout --inputbox 'Digite o nome:' 0 0 )

              mv agenda agenda.tmp
             
              grep -v $nome agenda.tmp > agenda

              rpm -rf agenda.tmp
           ;;
   
           0)  break
  
           ;;
esac
done

Scripts recomendados

Script para instalação de um servidor web

Normalizar Áudio de Arquivos MP3

Autenticação Speedy Business

Sincronizando seu hosts.deny com blacklist online

Script shell para automatizar downloads do MegaUpload


  

Comentários
[1] Comentário enviado por coelhoposa em 27/02/2012 - 19:44h

Legal, posso incluir no meu Linux que estou criando, o SimplyOS? Dôu os créditos.

[2] Comentário enviado por gezildo em 03/11/2013 - 15:28h

obrigado


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts