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?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. Shell Programming and Scripting
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
3. Programming
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
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
scl(1) General Commands Manual scl(1)
NAME
scl - Setup and run software from Software Collection environment
SYNOPSIS
scl <action> <collection1> [<collection2> ...] <command>
scl <action> <collection1> [<collection2> ...] -- <command>
scl {-l|--list} [<collection1> <collection2> ...]
DESCRIPTION
This manual page documents scl, a program which is an utility for running software packaged as a Software Collection.
scl utility allows to execute an application which is not located in the filesystem root hierarchy but is present in an alternative loca-
tion. This application can still use and benefit from software installed in the root filesystem. In order to let an application be visible
to the system one has to use scl utility as an interface.
<action> is a script name to execute in a bash environment before the application itself takes in executed. Currently only enable scriptlet
is mandatory which is needed to update search paths, etc.
One can enable more Software Collections if needed and therefore one can use multiple collections which are enabled by the left-right order
as present on scl command-line.
<command> is an arbitrary command or set of commands to execute within the Software Collection environment enabled. Control is returned
back to the caller with the original environment as soon as the command finishes. If <command> is '-' (dash) then it is read from the stan-
dard input.
Note: if you use <command> consisting of multiple arguments, you either need to use quotes or the -- command separator. Everything that
follows the separator will be considered a command or its argument.
Note: some commands modify user environment in some way. Those commands may potentially break SCLs, as their activation also usually
depends on env. modification as well. Typical examples of such commands are su and sudo. Every collection modifies the environment differ-
ently, thus more details may be found in the documentation of the particular collection.
OPTIONS
-l, --list
Lists all installed Software Collections on the system.
-l, --list <collection1> <collection2> ...
If a collection name is specified then list of installed packages belonging to the collection is listed.
EXAMPLES
scl enable example 'less --version'
runs command 'less --version' in the environment with collection 'example' enabled
scl enable foo bar bash
runs bash instance with foo and bar Software Collections enabled
cat my_command | scl enable baz -
run set of commands listed in my_command file in the environment with baz Software Collection enabled
scl -l list all installed collections
scl -l example
list all packages within example collection
AUTHOR
scl was written by Jindrich Novy <jnovy@redhat.com> and Jan Zeleny <jzeleny@redhat.com>
scl(1)