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

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.

Your script obviously does not read from stdin. What device/file descriptor does it read from?

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

Script contains ...

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

Did you try to run the script with some volume mounted on /dev/rmt0 ?

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:-

( 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?

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