Automatically execute all programs in a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automatically execute all programs in a directory
# 1  
Old 06-09-2010
Automatically execute all programs in a directory

Hello.

The last days I extended an open-source C++ library by some faster functions. This library provides a lot of short test programs which guarantee that the library works exactly.

The compilation of each test works in a Makefile automatically.

What I need is a shell script which executes all the build programs one after another. Furthermore I would like to get prompt to press the return key between two program executions.

Since I have nearly no experience with unix shell programming I would be glad if anyone could tell me how to do this.

Thanks in advance.

Regards

Max
# 2  
Old 06-09-2010
Code:
#!/bin/sh

make targetone
echo -n "Hit ENTER"
read

make targettwo
echo -n "hit ENTER"
read

...

# 3  
Old 06-09-2010
Hammer & Screwdriver

Code:
$ perl -e 'print "Step 1\n"; print "Press ENTER to continue..."; $a=<STDIN>;
           print "Step 2\n"; print "Press ENTER to continue..."; $a=<STDIN>;'

# 4  
Old 06-09-2010
Thanks.

But is there a possibility to read out all programs (all files without an anding) automatically? So that I do not have to write all targets in a makefile?

Something like:

foreach program in listOfProgramsInCurrentDir
run program

Do you know what I mean?

Thank you for your answers.

Cheers
# 5  
Old 06-09-2010
Probably, but you never gave any information whatsoever on that; do you have a list, or are we supposed to trawl the current directory for executable files, or executables but not scripts(if there's a ./configure in there you probably don't want your test system to run it! Smilie ) or should we look for files with a certain extension, or are you expecting us to query the makefile itself somehow, etc, etc, etc. Your pseudocode was the first hint we had. Smilie

To just run a list of commands from a textfile:

Code:
while read COMMAND
do
        $COMMAND
        echo -n "Hit enter"
        read
done < textfile

Or to find all executable files:

Code:
find ./ -maxdepth 1 -execuable -not -name 'configure' |
while read COMMAND
        $COMMAND
        echo -n "Hit enter"
        read
done

# 6  
Old 06-09-2010
The second one is what I searched for Smilie. Thank you. Sorry for my inaccurate problem description.

Best Regards

Max
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Need help on how to execute several programs

1. The problem statement, all variables and given/known data: Get each of these programs to run. Prove that you've done this(use script). Give a description of each program along with sample executions. These are the exact programs we were given. 2. Relevant commands, code, scripts,... (11 Replies)
Discussion started by: FaTaL
11 Replies

2. Shell Programming and Scripting

Automatically determining directory path for scripts and programs

I have some C++ code in the following directory structure /home/chrisd/tatsh/trunk/hstmy/ ├── baseLib ├── bin │ ├── awk │ ├── bash │ ├── diag │ ├── ksh │ │ └── TAG201011 │ ├── old │ ├── perl │ ├── prog │ ├── py │ └── tcsh ├── docs ├── fortran ├── others... (0 Replies)
Discussion started by: kristinu
0 Replies

3. UNIX for Advanced & Expert Users

How to i execute .rdf file oracle report automatically in cron tab unix

Hi, I want to execute .rdf file which uses oracle report in crontab ..Can you please help me out how to schedule it crontab.as it is a rdf file Please give any suggestions regarding the above issue. (0 Replies)
Discussion started by: soumyamishra
0 Replies

4. Fedora

Automatically execute a software without gui at boot

hi all, this is my first post here...i hope that this is the correct section to write my question. I have a distro linux without gui, only text mode. So, it's possible run automatically a command or a program as "top" or "ping" and get the result on the main shell , after the boot and after... (6 Replies)
Discussion started by: gangiaemi
6 Replies

5. UNIX for Dummies Questions & Answers

Initialization Problems - Cannot execute automatically

Figured out the first half but am still having a little trouble shooting problem with the Initialization Files. I am working in bash on a remote server. When I log on I am seeing the correct prompt but right before that I am also seeing this the id -u integer expression expected is what... (2 Replies)
Discussion started by: moonunit
2 Replies

6. AIX

Execute "telinit q" while programs are running ?

Hi, I want to make changes to inittab file and reread it using "telinit q" to make changes effective immediately. Is it safe to do that while important apps are running ? thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

7. UNIX for Advanced & Expert Users

i want a script to execute if the time is 12:00 automatically

i write a script for displaying a xmessage.But i want it to run automatically for every one hour.can any one help me. (2 Replies)
Discussion started by: lakshmananindia
2 Replies

8. Shell Programming and Scripting

help to execute programs in sequence through batch

I need help to create batch file . I want to run some programs in sequence in batch mode . I have one file which contains the name of program and command The test.bat file contain this data stsrun -v devel area1.exp stsrun -v devel prime1.exp stsrun -v devel treat.exp Please help... (1 Reply)
Discussion started by: getdpg
1 Replies

9. Shell Programming and Scripting

Removing files automatically from a directory after 30 days.

Hello; I have a directory that is collecting log and act files. I need to write a script that will remove these files once they are 30 days old. I have read through a number of threads on this site that have given me a great deal of information. However I have what seems to be a unique... (7 Replies)
Discussion started by: justinb_155
7 Replies
Login or Register to Ask a Question