01-25-2009
Reading Commands From a File
I am trying to create a script that will read bash commands from a text file and execute them. These commands would all be defining variables. Is this possible, and if so, how do I do it. Any help would be greatly appreciated.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can some tell me how can i read a file sequentially i.e one line after other , which contains list of commands.
For ex :
My src_file looks like
awk -F:"-" '/abc/ {print $1}
awk -F:"-" '/zzz/ {print $1}
awk -F:"-" '/ppp/ {print $1}
I tried with for loop like this,
for i in `cat... (8 Replies)
Discussion started by: braindrain
8 Replies
2. Shell Programming and Scripting
Hi
How can i dynamically read files names from a list file and execute them from a single shell script.
Please help its urgent
Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
3. Shell Programming and Scripting
I have a function that returns a bunch of exit codes, say func1, and in my code I'm trying to execute that function in an if statement. This is the closest I could get.
f1call=`func1 $arg1 $arg2`
if ]; then
...
fi
When I run the script the function never gets called. What's the right way... (7 Replies)
Discussion started by: eur0dad
7 Replies
4. Shell Programming and Scripting
I have to use shell script to run series of commands on another unix box by connecting through SSH and giving user credentials. For running commands on remote machine I have to use options reading from a local file.
Process:
Connecting to remote unix server <host1.ibm.com> through ssh
Login: ... (2 Replies)
Discussion started by: itsprout
2 Replies
5. Shell Programming and Scripting
Need to develop a unix shell script for the below requirement and I need your assistance:
1) search for file.log and file.bad file in a directory and read them
2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file
4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies
6. Shell Programming and Scripting
Hi All
I have written the following script:
#!/bin/ksh
while read cmdline
do
echo `$cmdline`
pid="$cmdline"
done<commands.txt
===========
commands.txt contains:
ps -ef | grep abc | grep xyz |awk '{print $2};
My objective is to store the o/p of the command in a variable and do... (8 Replies)
Discussion started by: rahulparo
8 Replies
7. Shell Programming and Scripting
Using ksh on AIX what I am trying to do is to read the ls -l output from a file in a do while loop line by line. Extract the user name(3rd field) and the directory/file name(9th field) using awk and save them into variables. su -c to the user and change directory/file permisions to 777. Script I... (13 Replies)
Discussion started by: zubairom
13 Replies
8. UNIX for Dummies Questions & Answers
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies
9. Shell Programming and Scripting
So I'm stumped.
First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes.
I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 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)