How to pass Enter key stroke , tried all options?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to pass Enter key stroke , tried all options?
# 1  
Old 07-27-2016
Debian How to pass Enter key stroke , tried all options?

Hi Friends,

I am unable to pass Enter key stroke to shell script. Tried all options, but no luck.
Please help..

Script: bkpscript.sh

Code:
tam01# ./bkpscript.sh < file.txt
Mount volume 1 on /dev/rmt0.
        Press Enter to continue.  
tam01# 
tam01# 
tam01# 
tam01# echo "" |./bkpscript.sh  
Mount volume 1 on /dev/rmt0.
        Press Enter to continue. 
tam01# 
tam01# 
tam01# ./bkpscript.sh < file.txt
Mount volume 1 on /dev/rmt0.
        Press Enter to continue. 
tam01# 
tam01# 
tam01# yes " " | head -1 | ./bkpscript.sh 
Mount volume 1 on /dev/rmt0.
        Press Enter to continue.  
tam01# 
tam01# echo -ne '\n' | ./bkpscript.sh                                                                                          
Mount volume 1 on /dev/rmt0.
        Press Enter to continue.




Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 07-27-2016 at 03:57 AM.. Reason: Added code tags.
# 2  
Old 07-27-2016
Your script obviously does not read from stdin. What device/file descriptor does it read from?
# 3  
Old 07-27-2016
It would be very helpful if you posted the script, but at a minimum we would need to know the command that actually calls the backup process to write to tape.

This could be tar, cpio, fsdump, fsbackup, savevg, exp (Oracle) ontape (Informix) or loads of others and they may not accept an externally called ENTER, i.e. they ignore any queued input. There may be a flag to make it non-interactive, but there are so many choices at the moment it would be futile to suggest anything.



Thanks, in advance,
Robin
# 4  
Old 07-28-2016
Script contains ...

Code:
find /amaz_backup/export/AAA/ /amaz_backup/export/BBB/ /amaz_backup/export/CCC/  -print | backup -v -i -f /dev/rmt0 ; echo $?



Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 07-28-2016 at 06:21 AM.. Reason: Added code tags.
# 5  
Old 07-28-2016
Did you try to run the script with some volume mounted on /dev/rmt0?
# 6  
Old 07-28-2016
So is this AIX?

You may be able to trawl through the mksysb script and find where it does backbyname and find where that leads you. I don't have an AIX server available at the moment.

You might also get away with forcing the extra ENTER like this:-
Code:
( find /amaz_backup/export/AAA/ /amaz_backup/export/BBB/ /amaz_backup/export/CCC/  -print ; echo ) | backup -v -i -f /dev/rmt0 ; echo $?

No guarantees though.

Is there a special reason to use backup? Would cpio or tar not be simpler?
Code:
tar -cf /dev/rmt0 /amaz_backup/export/AAA /amaz_backup/export/BBB /amaz_backup/export/CCC

If it is AIX, then tar supports the -L flag to read an input file. You would send your output from the find in there then read it in.

I'm pretty sure the cpio will accept the output from your find directly too with the -o flag.


I hope that this helps,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simulate enter key

I have a popup window that appears on every boot up. I would like to have it dismissed automatically each time instead of having to hit the enter key. I thought I could write a script that would execute on startup. I tried this xdotool key return andy@7_~/Downloads$ xdotool key ... (7 Replies)
Discussion started by: drew77
7 Replies

2. 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

3. Shell Programming and Scripting

Disable Enter key to be pressed

Hi Experts, I have a script in which I want to disable the "Enter" key press. Actually my script executes some process in background. So, till that background process is running, I don't want "Enter" key to be pressed by user. Is this can be achieved using trap command? (6 Replies)
Discussion started by: R0H0N
6 Replies

4. Shell Programming and Scripting

How to introduce delay in Shell Script till a key stroke.

Hi All, How to introduce delay in the Bash/Shell Script till key stroke. Below is the requirement.. 1.Execute set of commands. 2.Display the message echo "press any key to continue" Introduce a delay till key stroke. 3.Execute next set of commands. Thanks in Advance Sunil.K (5 Replies)
Discussion started by: sunilrk07
5 Replies

5. Shell Programming and Scripting

enter key solaris

Hi, When I run script on Sun Solaris (sassetup), it prompts to "Press Enter To Continue". Now I want to automate this, ie put sassetup in a script file. So, when I run this file, it should be executed automatically without waiting for anyone to press Enter Key. I have tried the following... (1 Reply)
Discussion started by: sajjunaqvi
1 Replies

6. Shell Programming and Scripting

Want read and an built in enter key stroke

i have script like: echo "enter name" read a I do not want to press enter key i have tried with ascill of enter as (\013) but still it wait for enter , please resolve my problem (2 Replies)
Discussion started by: RahulJoshi
2 Replies

7. Shell Programming and Scripting

trap signal for enter key

hi , What is the trap signal for "ENTER key"? (4 Replies)
Discussion started by: Sreejith_VK
4 Replies

8. UNIX for Dummies Questions & Answers

key stroke in sco unix

Hi, Please tell me substitute for esc+\ (used in solaris) in case of sco unix. Thanks, Pintu (1 Reply)
Discussion started by: pintupatro
1 Replies

9. 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

10. Shell Programming and Scripting

read the ENTER key

Hi , I do the following : ]echo "Do you want to say yes or no ?(y/n):\c" read ans here 'n' is the default value.that means if the user press ENTER key then it should be 'n' . Now how do i know that the user has pressed ENTER key.What will be stored in my variable 'ans'. (4 Replies)
Discussion started by: sars
4 Replies
Login or Register to Ask a Question