Order of execution of instructions in a script shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Order of execution of instructions in a script shell
# 1  
Old 09-13-2015
Order of execution of instructions in a script shell

Hi all,

Here is a portion of my script test.sh:
Code:
#!/bin/bash

tar -cf $name.tar $name && pbzip2 $name.tar
2-Sending .tar.bz2 to destination node

Please, i have a question. The execution of the second instruction is done, but i do not see the result of pbzip2

I have to send this file pbzip2 to a destination node, but it is sended corrupt


Any explanation please ? Any idea of a solution? how can i block the execution until i have the file ?



Thanks a lot.
# 2  
Old 09-13-2015
Is the file OK on the initial node? Possibly it is an error in the transmission?
# 3  
Old 09-13-2015
Quote:
Originally Posted by chercheur111
Hi all,

Here is a portion of my script test.sh:
Code:
#!/bin/bash

tar -cf $name.tar $name && pbzip2 $name.tar
2-Sending .tar.bz2 to destination node

Please, i have a question. The execution of the second instruction is done, but i do not see the result of pbzip2

I have to send this file pbzip2 to a destination node, but it is sended corrupt


Any explanation please ? Any idea of a solution? how can i block the execution until i have the file ?



Thanks a lot.
It appears that $name in your script expands to an empty string. And, there is nothing you have shown us in this script that sets the variable name before you use it three times in your script.

Is the zip file different on the destination node when compared to the same file on the source node (assuming that you actually created a file named .tar.bz2 on the source node)?

Did you get a diagnostic from the tar command that you didn't shown us? Perhaps something like:
Code:
tar: no files or directories specified

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script Execution Order

Hi, I have two scripts which are mentioned in execute.sh more execute.sh ./script1.sh //line 1 should not return error ./script2.sh //line 2 may return error ./script2.sh //line 3 should not return error Condition: I want script1.sh to complete before starting script2.sh... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

3. UNIX for Advanced & Expert Users

Order of execution seem to be reversed with pipe

Hello I am seeing a weird behavior during the execution of the shell program. The shell programs loops through a file which has a list of files. for each file the programs cats the file, pipes the output to sed command and then on to an awk program. But while execution, the order of... (3 Replies)
Discussion started by: vamxdir
3 Replies

4. Shell Programming and Scripting

Multiple Interval cron issue with order of execution

55,0 5,6 * * * myScript This cron task will execute on 5:00AM, 5:55AM, 6:00AM and 6:55AM. Is there any possibility to make it run only in the order specified such as 5:55AM and 6:00AM (basically only on the 2 intervals) ? (1 Reply)
Discussion started by: vikram3.r
1 Replies

5. UNIX for Dummies Questions & Answers

shell script execution in ab initio

Hi All, How to execute shell script for running Ab initio graphs? Regards (0 Replies)
Discussion started by: eshalife
0 Replies

6. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

7. UNIX for Advanced & Expert Users

How to set the SGE job execution order for nested qsub?

Dear All I am trying to write a script to set the SGE job execution order. I named each job with 'job1', 'job2' and 'job3'. I want my script to do: When 'job1' execution is complete, 'job2' is executed; when both 'job1' and 'job2' are complete, 'job3' is executed. First, I tried this... (0 Replies)
Discussion started by: cliffyiu
0 Replies

8. Solaris

Program execution order like FIFO queue

Hi all: I have a problem with a C++ service runing on solaris 10. This service only set a signal on oracle table. When the service detect a cut off on the line (tcp/ip), trigger a cobol program for set the signal OFF. When the line is on again, the service trigger the same cobol program for set... (0 Replies)
Discussion started by: hcastellani
0 Replies

9. UNIX for Dummies Questions & Answers

Instructions for a bash shell script

Hi, I have written a series of bash shell scripts that I will putting on a website for anyone (ie people in my specific field) to download and use. I am currently writing a readme file that explains how to run them, and it has occurred to me that it would be a good idea to indicate that they are... (1 Reply)
Discussion started by: msb65
1 Replies

10. Shell Programming and Scripting

execution of shell script

How can I execute another shell script from one? Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question