hi guys,
i have here a little problem. shell is working fine, but when i enter all the info i need. i go to meniu command show all and i cant see the names i entered only e-mails. sry for my english ...
Code:#!/bin/bash meniu() { dialog --backtitle "Book"\ --title "meniu"\ --menu "Choose:" 13 60 7\ 1 "New entry"\ 2 "Search"\ 3 "Show all"\ 4 "Delete entry" 2> temp a=`cat temp` case $a in 1) dialog --backtitle "New entry" --inputbox "Name:" 20 50 4> temp d=`cat temp` dialog --backtitle "New entry" --inputbox "Surname:" 20 50 4> temp f=`cat temp` dialog --backtitle "New entry" --inputbox "Phone no.:" 20 50 4> temp h=`cat temp` dialog --backtitle "New entry" --inputbox "E-mail:" 10 50 2> temp l=`cat temp` echo "Name: $d Surname: $f Phone no.: $h E-mail: $l" >> kontaktai.txt meniu;; 2) dialog --backtitle "Search" --inputbox "Search criteria" 20 50 4> temp y=`cat temp` dialog --backtitle "Search" --msgbox "`grep "$y" kontaktai.txt`" 5 100 meniu;; 3) dialog --backtitle "Show all" --title "List:" --msgbox "`sort kontaktai.txt`" 40 100 meniu;; 4) dialog --backtitle "Delete entry"\ --menu "Choose" 10 50 2\ 1 "Delete single entry"\ 2 "Delete all entries" 2> temp pas=`cat temp` case $pas in 1) dialog --backtitle "Delete entry" --inputbox "Įveskite duomenys:" 20 50 4> temp m=`cat temp` dialog --backtitle "Delete entry" --yesno "Ar tikrai norite ištrinti šį įrašą: `grep "$m" kontaktai.txt`?" 10 100 c=$? case $c in 0) dialog --backtitle "Delete entry" --msgbox "Įrašas ištrintas" 0 0 grep -v "$m" kontaktai.txt > temp rm kontaktai.txt mv temp kontaktai.txt;; 1) dialog --backtitle "Delete entry" --msgbox "Įrašas neištrintas" 5 50;; 255) dialog --backtitle "Delete entry" --msgbox "paspausta Esc" 5 50;; esac meniu;; 2) dialog --backtitle "Delete all entries" --yesno "Are u sure you want to delete all entries ?" 10 50 x=$? case $x in 0) dialog --backtitle "Delete all entries" --msgbox "Įrašai ištrinti" 0 0 rm kontaktai.txt;; 1) dialog --backtitle "Delete entry" --msgbox "Įrašas neištrintas" 5 50;; 255) dialog --backtitle "Delete entry" --msgbox "paspausta Esc" 5 50;; esac meniu;; esac;; esac } meniu