running a simple script file with multiple commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers running a simple script file with multiple commands
# 1  
Old 02-27-2009
running a simple script file with multiple commands

I'm trying to run a script file with multiple commands that I would normally type into the command line. The commands are:

#!/bin/bash
diff Test1.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1.o0 > differences2
diff Test1a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1a.o0 >> differences2
diff Test2.o0 /usr3/ronelso4/Desktop/verificationKPC/Test2.o0 >> differences2
diff Test2a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test2a.o0 >> differences2

For some reason when I execute it all I get in the file are the last files differences not all of the files. What am I doing wrong?
# 2  
Old 02-27-2009
Hope I'm not starting with the too-obvious, but are you sure that there actually *are* any differences in the first 3 diffs? And you're sure that the diffs that are in the file are from the last diff? You could output each diff to a different file, instead of to the same file, and see what happens. Other than that, nothing looks incorrect in what you're doing. You might try:
Code:
#!/bin/bash
diff Test1.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1.o0 > differences1
diff Test1a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1a.o0 > differences1a
diff Test2.o0 /usr3/ronelso4/Desktop/verificationKPC/Test2.o0 > differences2
diff Test2a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test2a.o0 > differences2a
cat differences1 differences1a differences2 differences2a >> differences.all

In theory. that *should* give exactly the same end result (except for the filename) as your setup. Does it?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check status of long running multiple curl commands in shell script

I am working on script. it reads a file which contains multiple lines Ex; curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=1 curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=2 curl --write-out %{http_code} --silent ... (2 Replies)
Discussion started by: oraclermanpt
2 Replies

2. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

3. Shell Programming and Scripting

Create a UNIX script file with multiple commands

Hi Good morning all, I want to create script file with multiple commands. For ex: pmrep connect is one of the command to connect to repository. pmrep objectexport is another command to export objects to a file. These commands should run sequentially.But when i try to execute this, the first... (4 Replies)
Discussion started by: SekhaReddy
4 Replies

4. Shell Programming and Scripting

Issue with running multiple commands withing su command

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user and expect to do the following things A. Source the environment variables for BATGPRD Database (the file used for sourcing is shown below after the script) B. Shutdown the DB from sqlplus -- The... (13 Replies)
Discussion started by: omega3
13 Replies

5. Shell Programming and Scripting

Get multiple values from an xml file using one of the following commands or together awk/perl/script

Hello, I have a requirement to extract the value from multiple xml node and print out the values to new file to compare. Would be done using either awk/perl or some unix script. For example sample input file: ..... ..... <factories xmi:type="resources.jdbc:DataSource"... (2 Replies)
Discussion started by: slbmind
2 Replies

6. Shell Programming and Scripting

Running multiple commands stored as a semi-colon separated string

Hi, Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g., # vs="echo a; echo b;" # $vs a; echo b; I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
Discussion started by: svhyd
2 Replies

7. Shell Programming and Scripting

Simple script editing text files and running commands

Okay this will probably have multiple parts to it but I don't really want to trouble you guys with more help because I'm a total noob so I can just do the first part by hand (it's just editing a few hundred lines of text in a file; I have to do the same thing on each line and I'm sure there's a... (2 Replies)
Discussion started by: guitarscn
2 Replies

8. Programming

Running Multiple Unix commands in qx

Hi All, Is there anything wrong with below syntax? qx {perldoc -v ModuleName.pm | grep -i Description } BTW, this question is related to Perl. Thanks. (3 Replies)
Discussion started by: jal_capri
3 Replies

9. Shell Programming and Scripting

Running multiple unix commands in a single script

Hi, I would like to write a script with include more than 6 unix commands. my script like below: echo " script started" ls -ld bdf | grep "rama" tail -10 log.txt ... .. ... now, i want to run above unix commands one by one. example: first the ls -ld command will be... (3 Replies)
Discussion started by: koti_rama
3 Replies

10. Shell Programming and Scripting

Need Help Running a simple script

The following works: $ zgrep "TIME *0 *3 *10 " /opt/oss/report.gz | sed -e "s/ */ /g" 24659 TIME 0 3 10 OWNER 0 8 1 I need to queary over 1000 records, so I try: for b in $(cat /home/user/file | awk '{print $3,"*"$4,"*"$5,"*"$6" "}' | sed 's/^/"/' | sed 's/$/"/') do zgrep $b... (2 Replies)
Discussion started by: tony3101
2 Replies
Login or Register to Ask a Question