Sponsored Content
Top Forums Shell Programming and Scripting shell scripts do not exit once completed Post 302690249 by bakunin on Wednesday 22nd of August 2012 04:48:43 PM
Old 08-22-2012
The first thing is you have written

Code:
command .... << EOF

instead of

Code:
command .... <<EOF

notice the space character, which may be a problem.

further, you have indented the code, which is not entirely possible with here-documents: the closing "EOF" must be at the beginning of the line:

Code:
# this will work:
command .... <<EOF
text to send to command
EOF

# but this will not, because of the last line:
command .... <<EOF
    text to send to command
    EOF

You can use indented closing clauses if you prepend the opening clause with a minus sign:

Code:
# this will work:
command .... <<-WORKSTOO
   text to send to command
   WORKSTOO

but don't know if this is the case in ksh too, i only know for sure it works in bash.

I suggest you go over this script (which has some other design deficits too)
with someone knowledgeable to make it better written.

I hope this helps.

bakunin

Last edited by bakunin; 08-23-2012 at 05:11 AM..
This User Gave Thanks to bakunin For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit status of Invoking two or more scripts in background

I have a sript which is going to trigger other 3 scripts in background simultaneously for eg: Main Script:(main.sh) ----------- sh a.sh & sh b.sh & sh c.sh & How to catch the exit status and store it in a variable for all those three scripts in main script. Is there any other way of... (4 Replies)
Discussion started by: Omkumar
4 Replies

2. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

3. Shell Programming and Scripting

exit a shell script!!

could somebody tell me please how to exit a shell script: if then echo "No arguments detected" exit 1 fi ... echo "still there" # is displayed .. :-( (4 Replies)
Discussion started by: sami98
4 Replies

4. Shell Programming and Scripting

How to pass parameter from sqlplus(procedure completed) to your shell script

if then # mail -s "Import failed file does not exist" sanjay.jaiswal@xyz.com echo "FILE does not exist" exit 1 fi echo "FILE EXIST" size=-1 set $(du /export/home/oracle/nas/scott21.dmp.gz) while do echo "Inside the loop" size=$1 set $(du... (1 Reply)
Discussion started by: sanora600
1 Replies

5. Shell Programming and Scripting

check exit status of bg scripts

HI All, I am running one shell script, in that script i am calling 4 scripts in the background. abc.ksh & efg.ksh & xky.ksh & mno.ksh & please let me know, how could i find the success and failure of each script. i Cannot use $?, because i want to run all the scripts in parellel. ... (2 Replies)
Discussion started by: javeed7
2 Replies

6. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

7. Shell Programming and Scripting

Java hangs even though shell script’s execution is completed

I'm trying to execute a script from within my java code. The execution of the script is over(it's pid is no more), but java is stuck on waitFor() method of the shell script process!. And yes, I'm reading output and error streams in 2 separate threads. Yes, they are being joined at the end(after... (0 Replies)
Discussion started by: pavanlimo
0 Replies

8. Homework & Coursework Questions

completed scripts

Does anyone know any websites where there are finished scripts, can be for anything Just want to copy and paste it and manipulate into something I could use. danke schon (0 Replies)
Discussion started by: cpcp1988
0 Replies

9. Shell Programming and Scripting

[BASH] Script to manage background scripts (running, finished, exit code)

Heyas, Since this question (similar) occur every now and then, and given the fact i was thinking about it just recently (1-2 weeks) anyway, i started to write something :p The last point for motivation was... (17 Replies)
Discussion started by: sea
17 Replies
MONGO(1)							  Mongo Database							  MONGO(1)

NAME
mongo - the Mongo command-line tool SYNOPSIS
mongo [OPTIONS] [DB_ADDRESS] [FILE+] DESCRIPTION
mongo is a JavaScript shell (with GNU readline capabilities). It supports interactive and non-interactive use. When used interactively, JavaScript can be used to query the database or perform any other function normally available with SpiderMonkey. Database output is dis- played in JSON format. If JavaScript files are specified on the command line, the shell will run non-interactively, running each one in sequence and then exiting. EXAMPLES
mongo start the shell, connecting to the server at localhost:27017 and using the test database mongo foo start the shell using the foo database at localhost:27017 mongo 192.169.0.5/foo start the shell using the foo database at 192.169.0.5:27017 mongo 192.169.0.5:9999/foo start the shell using the foo database at 192.169.0.5:9999 mongo script1.js script2.js script3.js run three scripts and exit OPTIONS
--shell run the shell after executing files --help show usage information --host HOST server to connect to (default HOST=localhost) --port PORT port to connect to (default PORT=27017) --nodb do not connect to mongod --eval SCRIPT evaluate JavaScript -u USERNAME specify user to log in as -pPASSWORD specify password of user (notice there is no space) COPYRIGHT
Copyright 2007-2009 10gen SEE ALSO
For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. AUTHOR
Kristina Chodorow 10gen June 2009 MONGO(1)
All times are GMT -4. The time now is 04:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy