The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-03-2008
neruppu neruppu is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 13
the shell not pause when execute read command

Hi, i facing a problem when run the script below..


while [ -z "$ea_ident" -o -n "`grep 2>/dev/null \"^EA $ea_ident$\" $EA_run_file`" ]
do

if [ $all_OMC -ne 1 ]
then
printf "Please enter a name : [${omc_ident}] "
read response # the problem occur here

if [ -z "$response" ]
then
ea_ident=${omc_ident}
else
#
# Check that name does not contain invalid characters
#
ea_ident=`echo $response | tr -d "/ \011"`

if [ -z "${ea_ident}" -o "${ea_ident}" != "${response}" ]
then
echo
echo "Sorry, not a valid name!"
echo "Must not contain spaces, tabs or '/'."
echo
ea_ident=
fi
fi
else
ea_ident=${omc_ident}
fi


if [ -n "`grep 2>/dev/null \"EA $ea_ident$\" $EA_run_file`" ]
then
echo "That name is already in use."
fi

done



$ea_ident is a data , when get into the loop, when excute read command, shell suppose to pause and wait for user input...

But in my case, its not and straight away execute the
next statement -> if [ -z "$response" ] ,

i did try to use </dev/tty but yet still no use..

Please post me any solution for this... Thanks

Last edited by neruppu; 07-03-2008 at 04:14 AM..