Sponsored Content
Top Forums Shell Programming and Scripting Help with make sure shell script execute instruction in flow Post 302507153 by edge_diners on Tuesday 22nd of March 2011 11:22:42 PM
Old 03-23-2011
Help with make sure shell script execute instruction in flow

Hi,

I want to write a shell script to make sure all the instruction is executive in flow.
eg.
I want my shell script to run finish this two progress first:
Code:
./program input_file_1.txt > input_file_1.txt.out &
./program input_file_2.txt > input_file_2.txt.out &

After then, only run the following command by using the output result from the above progress:
Code:
cat *.txt.out > input_file.final

Below is the content of the shell script that I wrote:
Code:
#!/bin/sh
./program input_file_1.txt > input_file_1.txt.out &
./program input_file_2.txt > input_file_2.txt.out &
cat *.txt.out > input_file.final

Unfortunately, when I running the shell script above. It will automatic execute the "cat *.txt.out > input_file.final". Even though my "./program input_file_X.txt > input_file_X.txt.out &" is still running. End up, my "input_file.final" is empty since the first two progress is still running and without produce any output file yet Smilie

Does anybody got any idea how to make sure the above shell script will start running "cat *.txt.out > input_file.final" only when the first two progress is run finish.

Thanks for any advice.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

2. Shell Programming and Scripting

Is there a way to make bash [or another shell] use all CPU cores to execute a single script?

I wrote a very simple script that matches combinations of alphabetic characters (1-5). I want to use it to test CPU speeds of different hardware/platforms. The problem is that on multi-core/processor systems, only one CPU is being utilized to execute the script. Is there a way to change that?... (16 Replies)
Discussion started by: ph0enix
16 Replies

3. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

4. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

5. UNIX for Dummies Questions & Answers

can't execute a shell script

Hi all, As i want to know how the shell command "nohup" worked.I logged in as the user named vincent through Gnome.Then i press ctrl+atl+F1 changed into a console and logged in as another user named kinsley.The user "kinsley" is added by me with "useradd",and now there's no HOME directory for... (6 Replies)
Discussion started by: homeboy
6 Replies

6. Shell Programming and Scripting

Continue an instruction on more than one line in a script shell ?

Hello, I have a very long instruction to write, but, for lisibility reasons, I would like to cut it on more than one line and comment each lines. is it possible ? thanks :b: (1 Reply)
Discussion started by: shadok
1 Replies

7. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

8. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

9. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (1 Reply)
Discussion started by: radha254
1 Replies

10. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (5 Replies)
Discussion started by: radha254
5 Replies
mosy(8) 						      System Manager's Manual							   mosy(8)

NAME
mosy - The managed object syntax compiler. SYNOPSIS
/usr/sbin/mosy [-d] [-i] [-o output_file] [-s] [-1] input_file OPTIONS
Specifies no duplicate entries in the output file. By default, if duplicate entries exist in the input file, they will also exist in the output file. Specifies that errors are ignored. This option causes the mosy program to create an output file even if it encounters errors. The default behavior is that the mosy program generates no output file when errors are encountered. Specifies the file to create for mosy output. If not specified, the output file is derived from the input file name by replacing the suffix with or appending input_file is not specified (or is specified as a hyphen (-) for standard input), output goes to standard output. You can also use a hyphen (-) to specify the output file name, which means output to standard out. Indicates silent mode which turns off the default behavior of printing out objects names, type names, and identifiers. Specifies that the mosy program will perform only the first validation pass when compiling. The mosy program prints the input_file contents as it parses, which is useful when debugging syntax errors. OPERANDS
Specifies a text file in MIB format describing a set of managed objects. If you do not specify an input_file or specify a hyphen (-), the program accepts input from standard input. DESCRIPTION
The mosy program reads a description of an SNMP-managed objects module (extracted from a MIB) and produces a simple ASCII file containing equivalent definitions. The output file is used by various management applications. In particular, mosy output files are used as input to the snmpi program when developing extensible SNMP subagents for Tru64 UNIX. The input_file is typically obtained by cleaning up an RFC file that defines a MIB. (You can use the /usr/examples/esnmp/mib_converter.sh script to perform this task.) For a complete description of using mosy and developing subagents refer to the Network Programmer's Guide. EXAMPLES
Compile the file chess.my with the output going to the file chess.defs. # mosy chess Clean up the MIB defined in RFC1514.txt and compile it, placing the output in file fred.objects # /usr/examples/esnmp/mib-converter.sh < rfc1514.txt > rfc1514.my # /usr/sbin/mosy -o fred.objects rfc1514.my You must copy the /usr/examples/esnmp/mib-converter.sh program to another directory and make it executable in order to perform this operation. FILES
SEE ALSO
Commands: snmpd(8), snmpi(8), snmp_request(8) Network Programmer's Guide IDENTIFICATION
Marshall T. Rose, Performance Systems International This work was partially supported by the U.S. Defense Advanced Research Projects Agency and the Rome Air Development Center of the U.S. Air Force Systems Command under contract number F30602-88-C-0016. It has been modified for use in Tru64 UNIX extensible SNMP. mosy(8)
All times are GMT -4. The time now is 01:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy