How to batch-processing numerous shell scripts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to batch-processing numerous shell scripts?
# 1  
Old 09-08-2011
Network How to batch-processing numerous shell scripts?

How to batch-processing numerous shell scripts?
how to record the result of all the scripts as a report? then, I can analysis the process result.

I want to process numerous shell scripts in my working directory:
the directory name is consistent with shell scripts name, that is to say, CLI001.sh is in the directory named CLI001, and so forth.

e.g.:The numerous shell scripts named: CLI001.sh, CLI002.sh,...

Below is the code I created:

Code:
#!/bin/bash
 
for i in CLI*
do
        cd `echo $i`
        pwd
        eval ./*.sh
        cd ..
done

# 2  
Old 09-08-2011
Although you did not mention that something went wrong I suppose that
your script has problems with the eval statement, which expects a shell command
instead of a script filename. You may try something like this:
Code:
#!/bin/bash
for i in CLI*
do
    test -d "$i" && cd "$i" || continue
    pwd
    test -f "$i.sh" && sh "$i.sh"
    cd ..
done

This User Gave Thanks to hfreyer For This Post:
# 3  
Old 09-08-2011
@hfreyer, thanks for your suggestion, it works.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Batch processing files through an interactive script

I am newish to the site and to unix. I have a functioning interactive script running on Mac that sorts and processes files located in an unsorted folder on my desktop. As it currently stands, the user types jpg into the command line, the script executes and iterates through the unsorted... (8 Replies)
Discussion started by: Braveheart
8 Replies

2. Shell Programming and Scripting

How to write BTEQ batch scripts in UNIX?

Hi All, I need to write Unix shell script. To star with : I need to do some file checking on unix file system, then based on file existance, I need to run diff SQL in Teradata Bteq. After that, depending on Results of SQL, I need to code other shell scripting like moving file, within same... (4 Replies)
Discussion started by: Shilpi Gupta
4 Replies

3. Shell Programming and Scripting

Sftp batch processing commands

Hello, I have a UNIX script to sftp batch processing. Here is my sftp command. ftp -b toopc userid@sftp.hostname.com In the file toopc I have the following commands: mget *.csv bye This brings in all files with an extension of .csv However, I need to only bring in files that ... (6 Replies)
Discussion started by: schlinzj
6 Replies

4. UNIX for Dummies Questions & Answers

Need equialent command for batch scripts

Hi Friend, what is the equivalent command for batch scripting of tail -1. for example : i have a.txt file with below the contents. i need to print last line --------------------------------- Use descriptive thread titles when posting. For example, do not post questions with subjects like... (3 Replies)
Discussion started by: Jewel
3 Replies

5. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

6. Shell Programming and Scripting

Processing different jobs as a batch process

Hi All, I want to process consecutive jobs in a sequence but when I execute 1 job ,the control does not return to the command prompt to continue with the next job. Can anyone help me here? Thanks (3 Replies)
Discussion started by: Taranjeet Singh
3 Replies

7. Shell Programming and Scripting

bash - batch processing folder of files by name

Hello Everyone!!! I need some help with a shellscript to batch process a folder of files with the imagemagick convert -append/+append command. The folder contains some hundred or thousand of small images in .png format which I would like to join together in order of their filenames. The... (3 Replies)
Discussion started by: imtombi
3 Replies

8. Shell Programming and Scripting

shell scripting-processing multiple scripts

I have four scripts to run. My 1st script will make script2 and script3 to run. I am setting a cron job for this script1 to run continuously. This script1 will check for 2 text files and based on the existance of those text files it will initiate the script2 and script3. Now my doubt is that... (2 Replies)
Discussion started by: RSC1985
2 Replies

9. Shell Programming and Scripting

Running shell scripts automatically without using Batch or at commands

I have been trying to run a unix script which contains many sql statements.I need to run this script every monday morning. I tried to run on command prompt, it works fine. But while I run it via batch or at command., it returns with library module could not be loaded (libcompat.1.o could not be... (3 Replies)
Discussion started by: ritzwan0
3 Replies
Login or Register to Ask a Question