The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to enter if-then condition on command prompt/line ? mpc8250 Shell Programming and Scripting 3 02-10-2008 12:27 PM
writing Enter key inside in shell script bishweshwar Shell Programming and Scripting 3 01-04-2008 12:45 PM
using enter key in shell script bishweshwar UNIX for Advanced & Expert Users 1 06-06-2007 11:24 PM
KSH Script/FTP (NEWBIE) mike509123 Shell Programming and Scripting 2 01-19-2006 02:14 PM
possible to run script to enter info within a program? lianderthal Shell Programming and Scripting 1 06-09-2005 07:40 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-23-2008
gwhelan gwhelan is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 40
Unhappy 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 (permalink)  
Old 06-23-2008
unSpawn unSpawn is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 53
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 (permalink)  
Old 06-25-2008
gwhelan gwhelan is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 40
Thanks.

Thanks for your reply unSpawn. I will try that.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0