LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   read ENTER KEY from Keyboard (https://www.linuxquestions.org/questions/linux-newbie-8/read-enter-key-from-keyboard-4175418765/)

KaRt 07-26-2012 08:04 AM

read ENTER KEY from Keyboard
 
" Enter to continue ......."
command for pass a enter key from keyboard

schneidz 07-26-2012 08:22 AM

is this the same question as this:
http://www.linuxquestions.org/questi...ss-4175418180/

it seems you solved it but you didnt really say how you solved it ?

KaRt 07-26-2012 08:38 AM

hi
while my apps installing it ask enter to continue. so read the Enter key from keyboard with user interaction.how i am pass this through script.

TobiSGD 07-26-2012 08:45 AM

This is quite contradictory. If you want it with user interaction you wouldn't pass it through a script. Please be more specific what exactly you want to achieve.

schneidz 07-26-2012 08:46 AM

my suggestion in your other thread was to look into expect. i've never had to use it before since most of my scripts are non-interactive but it mite help you.

KaRt 07-26-2012 08:56 AM

hi
simply my script need for print the message "ENTER to continue.........." and read a Enter key from keyboard and than proceed further steps.

schneidz 07-26-2012 08:59 AM

Code:

[schneidz@hyper Downloads]$ cat kart.ksh
#!/bin/bash

echo "enter to continue"
read
echo done
[schneidz@hyper Downloads]$ ./kart.ksh
enter to continue

done


KaRt 07-26-2012 09:07 AM

[schneidz@hyper Downloads]$ cat kart.ksh
#!/bin/bash

echo "enter to continue"
read
echo done
[schneidz@hyper Downloads]$ ./kart.ksh
enter to continue

done



..........
hi
my read take ENTER key alone if any other key pressed means its not proceed further

schneidz 07-26-2012 09:12 AM

Code:

[schneidz@hyper Downloads]$ cat kart.ksh
#!/bin/bash

echo "enter to continue"
 read var
if [ -z "$var" ]

then
 echo done
else
 echo continue
fi

[schneidz@hyper Downloads]$ ./kart.ksh
enter to continue

done
[schneidz@hyper Downloads]$ ./kart.ksh
enter to continue
hello-world
continue


KaRt 07-26-2012 09:22 AM

root@ubuntu:/kart# cat kart
#!/bin/bash

echo "enter to continue"
read var
if [ -z "$var"]
then
echo done
else
echo continue
fi
root@ubuntu:/kart# ./kart
enter to continue
hi
./kart: line 5: [: missing `]'
continue
..................
ENTER key worked but if i press other key it give error

schneidz 07-26-2012 09:26 AM

there needs to be a space between $var and ].

also please post code in code tags to make it easier to read.

KaRt 07-26-2012 09:30 AM

its Worked Thanks

Tinkster 07-26-2012 04:46 PM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

http://www.linuxquestions.org/questi...ss-4175418180/


All times are GMT -5. The time now is 01:14 PM.