If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > invoking a carriage return in a shell script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-27-03, 11:19
ldcoldwell ldcoldwell is offline
Registered User
 
Join Date: Aug 2003
Posts: 1
Question invoking a carriage return in a shell script

Hello all,

I am echoing a number of parameters into a control file for use later in my script. The program requires a carriage return after parameter entry, in order for it to continue with the next question.

Does anyone know how I can supply a carriage return in my control file. In other words I need to reproduce a keyboard entry of Carriage Return to my program via my control file parameters.


echo "1" >> $cntr

echo "yes" >> $cntr

echo "no" >> $cntr

program < $cntr

Thanks in advance...

Last edited by ldcoldwell; 08-27-03 at 11:31.
Reply With Quote
  #2 (permalink)  
Old 08-27-03, 11:34
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Post

Try:

echo "\n" >> $cntr

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 08-28-03, 09:19
Gus Gus is offline
Registered User
 
Join Date: Aug 2003
Location: Italy
Posts: 3
you can also try

echo "" >> $cntr

Gus ;-)
Reply With Quote
  #4 (permalink)  
Old 08-28-03, 09:44
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Can't you just echo your 'answers' in to the program rather than write them to a file?

e.g.

----------------------------

# prog.sh

read ans1
read ans2
read ans3

echo ans1 is $ans1
echo ans2 is $ans2
echo ans3 is $ans3

----------------------------


echo "yourAnswer1\nyourAnswer2\nyourAnswer3" | prog.sh


Or without the echo...

prog.sh << !!
yourAnswer1
yourAnswer2
yourAnswer3
!!


Last edited by Damian Ibbotson; 08-28-03 at 09:46.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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