# Bash Shell Script

**URL:** <https://community.unix.com/t/bash-shell-script/299198>\
**Category:** Shell Programming and Scripting\
**Created:** [November 14, 2011, 8:05pm UTC](https://community.unix.com/t/bash-shell-script/299198 "2011-11-14T20:05:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![help123](https://community.unix.com/letter_avatar/help123/32/5_5575768a8748004e209b776fc1b2916d.png) [@help123](https://community.unix.com/u/help123)\
**Post date:** [November 14, 2011, 8:05pm UTC](https://community.unix.com/t/bash-shell-script/299198/1 "2011-11-14T20:05:22Z")

</div>

HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one

```nohighlight
#!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following persons:" echoecho "[E]vans, Roland"echo "[J]ones, Mildred"echoread personcase "$person" in# Note variable is quoted. "E" | "e" ) # Accept upper or lowercase input. echo echo "Roland Evans" echo "4321 Flash Dr." echo "Hardscrabble, CO 80753" echo "(303) 734-9874" echo "(303) 734-9892 fax" echo "revans@zzy.net" echo "Business partner & old friend" ;;# Note double semicolon to terminate each option. "J" | "j" ) echo echo "Mildred Jones" echo "249 E. 7th St., Apt. 19" echo "New York, NY 10009" echo "(212) 533-2814" echo "(212) 533-9972 fax" echo "milliej@loisaida.com" echo "Ex-girlfriend" echo "Birthday: Feb. 11" ;; echo echo "Not yet in database." ;;esacechoxit 0

```

---

<div class="post-metadata">

**Author:** ![rdcwayx](https://community.unix.com/letter_avatar/rdcwayx/32/5_5575768a8748004e209b776fc1b2916d.png) [@rdcwayx](https://community.unix.com/u/rdcwayx)\
**Post date:** [November 14, 2011, 8:08pm UTC](https://community.unix.com/t/bash-shell-script/299198/2 "2011-11-14T20:08:47Z")

</div>

Are you kidding to paste one line script by this way, format it first.

---

<div class="post-metadata">

**Author:** ![help123](https://community.unix.com/letter_avatar/help123/32/5_5575768a8748004e209b776fc1b2916d.png) [@help123](https://community.unix.com/u/help123)\
**Post date:** [November 14, 2011, 8:15pm UTC](https://community.unix.com/t/bash-shell-script/299198/3 "2011-11-14T20:15:13Z")

</div>

```nohighlight
#!/bin/bash
 
# Crude address database
 
clear # Clear the screen.
 
echo " Contact List"
echo " ------- ----"
echo "Choose one of the following persons:" 
echo
echo "[E]vans, Roland"
echo "[J]ones, Mildred"
 
echo
 
read person
 
case "$person" in
# Note variable is quoted.
 
"E" | "e" )
# Accept upper or lowercase input.
echo
echo "Roland Evans"
echo "4321 Flash Dr."
echo "Hardscrabble, CO 80753"
echo "(303) 734-9874"
echo "(303) 734-9892 fax"
echo "revans@zzy.net"
echo "Business partner & old friend"
;;
# Note double semicolon to terminate each option.
 
"J" | "j" )
echo
echo "Mildred Jones"
echo "249 E. 7th St., Apt. 19"
echo "New York, NY 10009"
echo "(212) 533-2814"
echo "(212) 533-9972 fax"
echo "milliej@loisaida.com"
echo "Ex-girlfriend"
echo "Birthday: Feb. 11"
;;
 
echo
echo "Not yet in database."
;;
 
esac
 
echo

```

---

<div class="post-metadata">

**Author:** ![rdcwayx](https://community.unix.com/letter_avatar/rdcwayx/32/5_5575768a8748004e209b776fc1b2916d.png) [@rdcwayx](https://community.unix.com/u/rdcwayx)\
**Post date:** [November 14, 2011, 8:23pm UTC](https://community.unix.com/t/bash-shell-script/299198/4 "2011-11-14T20:23:17Z")

</div>

use while loop, for example, put your whole script in while loop

```nohighlight
while true 
do
  your script here.
done

```

---

<div class="post-metadata">

**Author:** ![help123](https://community.unix.com/letter_avatar/help123/32/5_5575768a8748004e209b776fc1b2916d.png) [@help123](https://community.unix.com/u/help123)\
**Post date:** [November 14, 2011, 8:40pm UTC](https://community.unix.com/t/bash-shell-script/299198/5 "2011-11-14T20:40:10Z")

</div>

tried that...however now the output flashes on the screen and disapears....

---

<div class="post-metadata">

**Author:** ![rdcwayx](https://community.unix.com/letter_avatar/rdcwayx/32/5_5575768a8748004e209b776fc1b2916d.png) [@rdcwayx](https://community.unix.com/u/rdcwayx)\
**Post date:** [November 14, 2011, 8:52pm UTC](https://community.unix.com/t/bash-shell-script/299198/6 "2011-11-14T20:52:46Z")

</div>

because of this line

```nohighlight
clear # Clear the screen.

```

remove it,

---

<div class="post-metadata">

**Author:** ![help123](https://community.unix.com/letter_avatar/help123/32/5_5575768a8748004e209b776fc1b2916d.png) [@help123](https://community.unix.com/u/help123)\
**Post date:** [November 14, 2011, 9:09pm UTC](https://community.unix.com/t/bash-shell-script/299198/7 "2011-11-14T21:09:33Z")

</div>

works perfect now!!! thanks a lot!
