The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ERROR: more than one instance of overloaded function "vprintf" has "C" linkage donatoll HP-UX 0 10-14-2008 06:35 AM
Strange error "host: isc_taskmgr_create: no available threads" Santi Linux 0 01-03-2008 05:49 AM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 07:45 AM
Help! "Bus error" and "CPU Panic" box wont boot hcclnoodles SUN Solaris 3 10-05-2006 05:38 PM
how to request a "read" or "delivered" receipt for mails plelie2 Shell Programming and Scripting 1 08-06-2002 04:26 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-23-2008
Blooper1980 Blooper1980 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
Thumbs down 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;
 

Bookmarks

Tags
read command vi unix user

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0