How to enter a return key in bash script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to enter a return key in bash script?
# 8  
Old 05-26-2010
Can you run the script using ksh instead of bash? and if so, do you get the same results?
# 9  
Old 05-26-2010
When you run "install" manually, what keystrokes do you press ?
For example do you press y<return> or just y ?
Can you typeahead when answering the questions manually?
# 10  
Old 05-26-2010
more importantly...to me, at least...what does this loop look like within the install script? Is it maybe allowing for a break, or similar...?
# 11  
Old 05-26-2010
Same result

Quote:
Originally Posted by jgt
Can you run the script using ksh instead of bash? and if so, do you get the same results?


---------- Post updated at 12:26 PM ---------- Previous update was at 12:24 PM ----------

Quote:
Originally Posted by methyl
When you run "install" manually, what keystrokes do you press ?
For example do you press y<return> or just y ?
Can you typeahead when answering the questions manually?
The keystrokes are in the list. y, n, Return key, string. It seems the first 2 responses that are y are accepted and processed. When it hits the return/blank line in gets lost.

---------- Post updated at 12:30 PM ---------- Previous update was at 12:26 PM ----------

Quote:
Originally Posted by curleb
more importantly...to me, at least...what does this loop look like within the install script? Is it maybe allowing for a break, or similar...?
The line that seems to be causing the problem in the install scroipt is:

more docs/env.txt

Manually, you need to page through the display.

In AIX and HPUX with the here-now playing on blank line is interperted as a return and it plays the entire file.

In Linux, the blank line in the here-now behaves differently.
# 12  
Old 05-26-2010
can you modify the install script to allow for an interrupt? Like:
Code:
more docs/env.txt 2>/dev/null

# 13  
Old 05-26-2010
Quote:
Originally Posted by curleb
can you modify the install script to allow for an interrupt? Like:
Code:
more docs/env.txt 2>/dev/null

The script is a vendor script. I'm trying to avoid modifying it.

One of my friends here told me to change the script to use cat instead of more. So this line:

more docs/env.txt

changed to:

cat docs/env.txt

Seems to work.

It's displaying a supported environment list that I really don't need in a scripted install but I really want to not have to remember to change the install script every time I get a new version.
# 14  
Old 05-26-2010
IF you're only going to run install within the outer script (ie, . ./install)...and not retain any environment settings afterward AND install isn't launching it's own shell within...you might just alias more to be cat early on in your outer script, and then unalias it before you'd exit (ie, alias more='cat' ... unalias more; exit ).

This might force the inner script to follow the alias, and not require any manual edits to the vendor script...

Lemme know...I'm curious. Should equate to something like the following example:
Code:
$ print $(alias more='cat' ;more file.cpy |head ;unalias more ) |sed "s/ \//\n/g"


Last edited by curleb; 05-26-2010 at 03:41 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script termination without pressing Enter key[nohup]

I have a script in which we have used nohup. Once script is executed it will be terminated only when enter key is pressed. I want the script to be terminated without pressing enter key nohup imqbrokerd -name user_id port 2>1 1>$home_`date` & I am a newbie to shell, Kindly please help (3 Replies)
Discussion started by: Suganbabu
3 Replies

2. Shell Programming and Scripting

Input password to bash script, save, and enter when needed

I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed. #!/usr/bin/expect -f... (2 Replies)
Discussion started by: jbrass
2 Replies

3. Shell Programming and Scripting

How to pass enter key or selected character in bash script?

hi, i've bash script thats working... but now i need to add a line....that prompts for user input....like yes and 1 as complete install.... so here's how it looks... $ cd 9200 (cd into directory) $./install (hv to type ./install to run install then ask for) ----do you want to... (4 Replies)
Discussion started by: kernel11
4 Replies

4. Shell Programming and Scripting

enter key or carriage return as input in perl

hi experts Question in perl i'm creating a script to take from user a different inputs one of them is the carriage return .. so that i want to make an if condition if the user hit enter key the user will go to previous step it something like that chomp ($input = <STDIN>); if ($input =~... (3 Replies)
Discussion started by: doubando
3 Replies

5. Shell Programming and Scripting

Simulating enter key via shell script

How to simulate enter key via shell script (2 Replies)
Discussion started by: proactiveaditya
2 Replies

6. Shell Programming and Scripting

BASH: Any Way to Get User Input Without Requiring Them to Hit the Enter Key?

I'm working on making a menu system on an HP-UX box with Bash on it. The old menu system presents the users with a standard text menu with numbers to make selections. I'm re-working the system and I would like to provide something more akin to iterative search in Emacs. I have a list of 28... (2 Replies)
Discussion started by: deckard
2 Replies

7. Shell Programming and Scripting

How to catch ENTER key inside the shell script?

Hi, I have a script in which i have to ask user to press the ENTER key to proceed further. can you please help me how can i achive this in my scripting? echo "All the executables builded Successfully " echo " Press Enter to Go Back to the Main Menu" ... (2 Replies)
Discussion started by: plaban.rout
2 Replies

8. Shell Programming and Scripting

writing Enter key inside in shell script

for automating telnet using shell script..... as we enter alphabetic characters inside shell script...how can we do the same for the enter key......Is there any character for the enter key so the enter key need not be pressed manually...... (3 Replies)
Discussion started by: bishweshwar
3 Replies

9. UNIX for Advanced & Expert Users

using enter key in shell script

without pressing the enter key ..manually... how can we read the enter key ..from the shell script..so that the script termintes automatically. eg: telnet a.b.c.d xxxx now " how to read the enter key" tho terminate the script (1 Reply)
Discussion started by: bishweshwar
1 Replies

10. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies
Login or Register to Ask a Question