HERE Document in Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HERE Document in Shell Script
# 1  
Old 05-09-2016
HERE Document in Shell Script

Hi,

I have a shell script to install one of our products. It comprises of commands that are specific to the product installation. These commands require user inputs at different stages.

To avoid manual feeding of inputs every time, I tried using HERE document.

it is like-
Code:
#! /usr/bin

command1 -console <<EOF
1
2
3
EOF

command2 -console <<EOF
1
2
0
3
EOF

....

HERE is working perfectly fine for all the commands except one. In that, moment it reaches to a particular option, instead of taking the input from HERE, it simply skips rest of the options and proceeds further without any error.

I tried capturing the output and errors, however, since, it is not resulting in any error at that stage, it is not capturing anything.

Can anyone please help me in how to troubleshoot it? Or, any other workaround?

Thanks,
Nishant



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

Last edited by RudiC; 05-09-2016 at 06:35 AM.. Reason: Added code tags.
# 2  
Old 05-09-2016
How about posting the section in question? And, please, verbatim! to enable us to analyse it, with proprietary info obfuscated if need be.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX Shell Script to Remove MongoDB Document-Based on Many inputs

Here I am in a position to write a Unix Shell script(.sh) to remove MongoDB collection documents. I know how to remove based on a condition like below and it works for me. eval 'db.Collection.remove({TimeStamp:{$lte: "'$var'"}}) But I need to change the remove statement based on a new parameter... (1 Reply)
Discussion started by: senthilmadhanT
1 Replies

2. Shell Programming and Scripting

Is it possible to create a here document by running a script interactively?

hi, i have script which installs around 20 packages. during installation of each package script will be prompted for user input. i need to run the script in non-interactive by using here document. is it possible to generate here document by running the script in interactive mode on Solaris?... (1 Reply)
Discussion started by: snreddy_gopu
1 Replies

3. Shell Programming and Scripting

Perl script for taking inputs from one script and storing them into a document.

Hi. I wanted to create a Perl script which can take the outputs of a Perl script as it's input and temporarily store them in a document. Need help. Thanks.:) (8 Replies)
Discussion started by: xtatic
8 Replies

4. Shell Programming and Scripting

Oracle Shell script | here document `EOF' unclosed

Hi folks I m creating script which is give me below error. $ ./function.ksh ./function.ksh: here document `EOF' unclosed Inside the script is #!/bin/ksh export ORACLE_SID=OECDV1 export ORACLE_HOME=/u01/app/oracle/product/10.2.0 export PATH=$ORACLE_HOME/bin:$PATH echo "sql is... (3 Replies)
Discussion started by: tapia
3 Replies

5. UNIX for Dummies Questions & Answers

Need Shell Script for document searching

I need a script that reads only printable characters (no duplicates) from all files in a directory and output them in a text file. (2 Replies)
Discussion started by: l20N1N
2 Replies

6. Shell Programming and Scripting

Modifying XML document with Unix Script

Hi, I have xml documents that I want to change a value in, I can do it using sed in a text document but not the xml document. I have read other posts that allow the change between tags but the part I wish to change is only a small part of data with the tags. e.g. <?xml version="1.0"... (2 Replies)
Discussion started by: heather.morton@
2 Replies

7. Shell Programming and Scripting

Here document and shell scripting

Hi I am unable to spot a error with my here document in the shell script. for sid in $sids do ORACLE_SID=sid ORACLE_HOME=$(grep $sid $ORATAB_LOC |cut -f2 -d':') $ORACLE_HOME/bin/sqlplus -s /nolog <<EOF @$HOME/sql/checkdb-status.sql EOF done I am getting the error... (8 Replies)
Discussion started by: xiamin
8 Replies

8. Shell Programming and Scripting

Shell Scripted Document Management System

Over the past 4 -5 years, I have cobbled together a rudimentary 'Document Management System' for a school district I support using Linux Bash Shell scripts.. The purpose of the scripting was to supplement features of a Job Applicant Center that had very simplistic methods of handle file... (1 Reply)
Discussion started by: rmuledeer
1 Replies

9. Programming

UNIX Shell Script to Create a Document of a PLSQL code.

Hi All, I am supposed to present the documentation for the PLSQL code (PACKAGES, PROCEDURE, FUNCTIONS) of my application. There are sufficient comments in my code. Has anyone written any Shell Script Utility which can parse the PLSQL code and generate some kind of document ( preferrably HTML not... (1 Reply)
Discussion started by: gauravsachan
1 Replies

10. Shell Programming and Scripting

here document to automate perl script that call script

I am trying to use a here document to automate testing a perl script however when the perl script hits a system(perl subscript.pl) call, input is no longer entered into this subscript. here is my script $ cat test.sh #ksh for testcase do program <<-EOF | tee -a funcscnlog.log y... (3 Replies)
Discussion started by: hogger84
3 Replies
Login or Register to Ask a Question