LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 07-26-2012, 08:04 AM   #1
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Rep: Reputation: Disabled
Cool read ENTER KEY from Keyboard


" Enter to continue ......."
command for pass a enter key from keyboard
 
Old 07-26-2012, 08:22 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 ?
 
Old 07-26-2012, 08:38 AM   #3
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Original Poster
Rep: Reputation: Disabled
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.
 
Old 07-26-2012, 08:45 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
Old 07-26-2012, 08:46 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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.
 
Old 07-26-2012, 08:56 AM   #6
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Original Poster
Rep: Reputation: Disabled
hi
simply my script need for print the message "ENTER to continue.........." and read a Enter key from keyboard and than proceed further steps.
 
Old 07-26-2012, 08:59 AM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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
 
Old 07-26-2012, 09:07 AM   #8
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Original Poster
Rep: Reputation: Disabled
[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
 
Old 07-26-2012, 09:12 AM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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
 
Old 07-26-2012, 09:22 AM   #10
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-26-2012, 09:26 AM   #11
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
there needs to be a space between $var and ].

also please post code in code tags to make it easier to read.
 
1 members found this post helpful.
Old 07-26-2012, 09:30 AM   #12
KaRt
LQ Newbie
 
Registered: Jul 2012
Location: india
Posts: 28

Original Poster
Rep: Reputation: Disabled
its Worked Thanks
 
Old 07-26-2012, 04:46 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
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/
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash - Read user input: URLs without the enter key stroke make Programming 2 09-23-2010 05:29 PM
"Enter Key" not working, how to map "Enter Key" functionality to "F9" Key srinihi Linux - Newbie 1 04-03-2009 03:46 PM
Bash & Xdialog - how to code to recognize ENTER key on keyboard.? craftybytes Linux - Software 6 04-03-2008 02:00 AM
Bash: how to read <enter> key linmix Programming 3 12-02-2005 05:38 PM
PS2 keyboard doesn't work after the "Enter" key is used gonefishing SUSE / openSUSE 1 11-06-2004 11:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration