Strange read "error"


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Strange read "error"
# 1  
Old 10-23-2008
PHP Strange read "error"

Good day.

I really hope U can help me with this as I'm stumped!
In the command line eg: read X; echo $x . Works perfectly fine.
Then running the same thing in my script it sometimes exiqute immediatly after pressing enter and continuiing. Not exiting the script I re-run the "read" section. Then after enterting some text. The curour jumps to the next line. I have to press enter 3-4 times before the script is running.
It's like there are 3/4 read's in a row, but the script only has one.
I've put echo's everywhere to find the problem, but the ONE read command creates random "read" instances. I can also just type 3-4 caracters and then the script continus to run.
VERY STRANGE!
Please help.

Here is the script so far.

#!/usr/bin/bash

key="Y"


#Display the email file with line number in it
function DISPLAYFILE {
nl EMAILADDYS
}





function REMOVE {
clear;
echo "Good day..."
echo
nl EMAILADDYS
echo
echo "Please select the number related to the email U would like to remove:"
read dn; echo $dn;
echo $dn
read;

#key="Y";
}


function ADDMAIL {
clear;
echo "ENTER STUFF:"
read newmail;
echo $newmail >> EMAILADDYS;
#key="Y";
}



DISPLAYFILE;
while [ $key != "X" ]; do
clear;
echo "GOOD DAY"
echo Below is the Email Addreses listed to recive the backup report
DISPLAYFILE;

echo "Please choose (A)dd or (R)emove or (E)exit."
printf ">"
read -n1 key
#echo $key

case $key in
a) ADDMAIL;;
A) ADDMAIL;;
R) REMOVE;;
r) REMOVE;;
e) echo "EXITING";
key="X";;
E) echo "EXITING";
key="X";;
*) echo "WRONG KEY PRESSED";
sleep 1;;
esac
done;
# 2  
Old 10-23-2008
Fixed

Hello there.

Problem is fixed.. Closed the session and opend an new one.
Tnx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

SPARC T4-1 "ERROR: boot-read fail"

Either I try to boot from USB bootable drive or from a bootable dvdrom, I am receiving a message ERROR: boot-read fail {0} ok probe-scsi-all This command may hang the system if a Stop-A or halt command has been executed. Please type reset-all to reset the system before executing this... (18 Replies)
Discussion started by: z_haseeb
18 Replies

2. Shell Programming and Scripting

Why awk print is strange when I set FS = " " instead of FS = "\t"?

Look at the following data file(cou.data) which has four fields separated by tab. Four fields are country name, land area, population, continent where it belongs. As for country name or continent name which has two words, two words are separated by space. (Data are not accurately... (1 Reply)
Discussion started by: chihuyu
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

Read from "list1" and list matches in "list2"

I want to print any matching IP addresse in List1 with List 2; List 1 List of IP addresses; 161.85.58.210 250.57.15.129 217.23.162.249 74.76.129.101 30.221.177.237 3.147.200.59 170.58.142.64 127.65.109.33 150.167.242.146 223.3.20.186 25.181.180.99 2.55.199.32 (3 Replies)
Discussion started by: lewk
3 Replies

5. Shell Programming and Scripting

Purpose of "read" and "$END$" in ksh ?

Hi, Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator? cat $AMS/version|read a b verno d DBVer=$(/usr/bin/printf "%7s" $verno) I checked that the cat $AMS/version command returns following output: ... (10 Replies)
Discussion started by: dbadmin100
10 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

read -n1 -r -p "Press..." key / produces error in bash shell script

Hello! Sorry, for my not so perfect english! I want to stop bash shell script execution until any key is pressed. This line in a bash shell script read -n1 -r -p "Press any key to continue..." key produces this error When I run this from the command line usera@lynx:~$ read... (4 Replies)
Discussion started by: linuxinho
4 Replies

8. Shell Programming and Scripting

read -p "prompt text" foo say "read: bad option(s)" in Bourne-Shell

Hallo, i need a Prompting read in my script: read -p "Enter your command: " command But i always get this Error: -p: is not an identifier When I run these in c-shell i get this error /usr/bin/read: read: bad option(s) How can I use a Prompt in the read command? (9 Replies)
Discussion started by: wiseguy
9 Replies

9. Linux

Strange error "host: isc_taskmgr_create: no available threads"

Dear Srs, I'm getting this error on a Linux box, running Apache 2.0.52: "host: isc_taskmgr_create: no available threads" Making some search for those strings in Google, didn't tell me anything about this.. appears to be related to SELinux, but it's disabled in the box. Any idea about... (0 Replies)
Discussion started by: Santi
0 Replies

10. Shell Programming and Scripting

how to request a "read" or "delivered" receipt for mails

Dears, I've written a script which allows me to send mails in different formats with different attaches. Now I still want to add a feature to this script. My users would like to be able to receive a "read" or "delivered" receipt for their mails. The script send mails on behalve of an specific... (1 Reply)
Discussion started by: plelie2
1 Replies
Login or Register to Ask a Question