Public bug reported:
I want to insert data into a database using shell programming but it
isn't working.can u help??creation and displayin is working.The
following is the code i have written..
ch=1
while test $ch -ne 0
do
echo -e "Menu"
echo -e "1.Create\n 2.Display\n 3.Insert\n 4.Delete\n 5.Modify\n
6.Search\n 7.Sort\n 8.Result\n 9.Exit\n"
echo -e "Enter your choice"
read ch
case $ch in
1)echo "enter name"
read name
echo "enter roll no"
read rno
echo "enter department"
read dept
echo "enter marks 1"
read m1
while test $m1 -gt 100
do
echo "enter marks 1"
read m1
done
echo "enter marks 2"
read m2
while test $m2 -gt 100
do
echo "enter marks 2"
read m2
done
echo "enter marks 3"
read m3
while test $m3 -gt 100
do
echo "enter marks 3"
read m3
done
echo -e "$rno\t$name\t$dept\t$m1\t$m2\t$m3">DATA
;;
2)cat DATA
;;
3) flag=1
while test $flag -ne 0
do
flag=0
echo "entr rno.."
read rno
awk 'if(rno==$1)
{
print $1>"tem"
}'DATA
if test -f tem
then
read flag<tem
rm -f tem
fi
done
if test flag -ne 1
then
echo -e "$rno">>DATA
fi
;;
9)exit
;;
esac
done
and this is how i executed:-
[EMAIL PROTECTED]:~/Documents$ . db.sh
Menu
1.Create
2.Display
3.Insert
4.Delete
5.Modify
6.Search
7.Sort
8.Result
9.Exit
Enter your choice
1
enter name
abc
enter roll no
1
enter department
comp
enter marks 1
99
enter marks 2
99
enter marks 3
99
Menu
1.Create
2.Display
3.Insert
4.Delete
5.Modify
6.Search
7.Sort
8.Result
9.Exit
Enter your choice
2
1 abc comp 99 99 99
Menu
1.Create
2.Display
3.Insert
4.Delete
5.Modify
6.Search
7.Sort
8.Result
9.Exit
Enter your choice
3
entr rno..
2
awk: line 1: syntax error at or near if
bash: test: flag: integer expression expected
Menu
1.Create
2.Display
3.Insert
4.Delete
5.Modify
6.Search
7.Sort
8.Result
9.Exit
Enter your choice
ProblemType: Bug
Architecture: i386
Date: Sun Sep 21 14:00:10 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/gnome-terminal
Package: gnome-terminal 2.22.1-0ubuntu2
PackageArchitecture: i386
ProcEnviron:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: gnome-terminal
Uname: Linux 2.6.24-16-generic i686
** Affects: ubuntu
Importance: Undecided
Status: Invalid
** Tags: apport-bug
--
Inserting into a database
https://bugs.launchpad.net/bugs/272681
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs