Script 'Enter' Command. Newbie.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script 'Enter' Command. Newbie.
# 1  
Old 06-23-2008
Data Script 'Enter' Command. Newbie.

Hi,

I have the following script which calls a program that asks for user input before progressing. I am new to scripting and this script was written by the previous admin. After $MERGE is executed the application associated with it needs user input - asks for 'Enter' to be pressed. At the moment the output is being redirected to /dev/null. I need to know how to script this. I have seen in other threads that you place a \r (carriage return) into the script. I don't know exactly how to do this though. Thanks for your help.

MERGE="/opt/application/application

$MERGE @list merged.pdf > /dev/null 2>&1

if (( $? != 0 ))
then
print "Merging files $patid_prev failed." >> $LOGFILE
else
patno=`echo $patid_prev | awk '{printf("%06d",$1)}'`
mv merged.pdf "$STARCH_DIR/${studyno}-${patno}.pdf"
fi


$MERGE > /dev/null 2>&1
if (( $? != 0 ))
then
print "PDF-Meld is not installed or not accessible." >> $LOGFILE
print "" >> $LOGFILE
print "Program aborted." >> $LOGFILE
rm -rf $WORKDIR
exit 1
fi
# 2  
Old 06-23-2008
If the app takes "yes" or enter you could check if you can use "/usr/bin/yes". Example:
Code:
doThis() { echo "Delete this continent?"; read ans; echo $ans; }
]$ yes | doThis

If it doesn't work then 'echo "\n"' is a newline, also see 'man echo'.
# 3  
Old 06-25-2008
Thanks.

Thanks for your reply unSpawn. I will try that.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automatically enter input in command line

Hi, This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. : #!/bin/bash ## Environnement ## LC_ALL=C ## Paths ## rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Discussion started by: Arnaudh78
10 Replies

2. AIX

AIX: How to find down who enter a command?

Hi I'm working on AIX. My question: for example, I'm logging in. I enter command "last" and then I know there are 3 people logging in from 3 different IP at the same time, 2 are in the same account. Then someone enters a command. Is there any way to know exactly who ( which IP ) enters... (9 Replies)
Discussion started by: bobochacha29
9 Replies

3. Shell Programming and Scripting

Loop logic, enter into respective IF as per enter input file name

have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value File 1 export SERVER_CONNECTION=//dvlna002:10001/SmartServer File2 export SERVER_CONNECTION=///SmartServer File3 export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies

4. Red Hat

How to create a command to enter into a dir?

Hi all, I want to create a command for entering into a specific dir. for eg if i want to go to /var/spool/postfix/pid at any point if i enter a command suppose "sp" in the command line it should take me to /var/spool/postfix/pid thanks (2 Replies)
Discussion started by: technoman
2 Replies

5. UNIX for Dummies Questions & Answers

TWO QUESTIONS...How to create your own command in UNIX server,How to enter data in a file by script

I am a quite newbie on UNIX SCRIPTING...Please help me solving this two questions... 1st Question; I want to create one command that will run a script when anyone use that command on that server... I mean, in the prompt if I put my name 'Rony' it will execute a script called 'rony.sh'. How can... (1 Reply)
Discussion started by: Rony-123
1 Replies

6. Shell Programming and Scripting

How to enter commands to the command prompt in a program

Hey, So I'm trying to write a program in unix to automate a process for my astrophysics research. Basically I want the program to prompt the user for some information and store the entered string of text as a variable. I know how to do this. This is where I need help: Now lets say I have a... (4 Replies)
Discussion started by: freemoniez
4 Replies

7. Shell Programming and Scripting

Enter the command to capture output--help

&& echo "PLEASE enter the command to capture output" || echo "Processing your command manual" x=$# echo $x while do while man $@ | read -r line do >$@.txt ... (1 Reply)
Discussion started by: rrd1986
1 Replies

8. HP-UX

command su : enter directly

Hi, a simple question : How can I sent user and password to the command su. I need this for a script, but the problem is the command su wait for the password. Thanks. (2 Replies)
Discussion started by: mvaquerm
2 Replies

9. Shell Programming and Scripting

Trapping Enter command !!

Hi I have written a script which works well .. It's divided into a series of jobs one running after another But on pressing the enter key the whole script goes haywire .. I want a way to trap this enter command and echo it as invalid input .. Any suggestions highly appreciated... Thanks :) (2 Replies)
Discussion started by: ultimatix
2 Replies

10. Shell Programming and Scripting

How to enter if-then condition on command prompt/line ?

Hi I have some trouble entering if-then condition in a single line on a command prompt in csh. Could someone show how does one do that ? eg: source .cshrc; cd $dir; pwd; test -d $backup_dir; if then mkdir -p ${backup_dir}; echo inside loop; fi; echo outside loop; mv -f... (3 Replies)
Discussion started by: mpc8250
3 Replies
Login or Register to Ask a Question