source: trunk/LMDZ.COMMON/libf/evolution/deftank/multiple_exec.sh @ 3452

Last change on this file since 3452 was 3354, checked in by jbclement, 13 months ago

PEM:
Addition of a script to execute multiple scripts in subdirectories (useful to launch multiple jobs at once for ex.) + Updates for several scripts in the deftank.
JBC

  • Property svn:executable set to *
File size: 839 bytes
Line 
1#!/bin/bash
2#############################################################
3### Script to exectute mutliple scripts in subdirectories ###
4#############################################################
5
6# Name of the file to execute in all subdirectories
7script_name="launchPEM.sh"
8#script_name="kill_launchPEM.sh"
9#script_name="clean.sh"
10#script_name="modify_startfi_orbit.sh"
11
12# Name of the template directory to skip
13tempdir_name="Template"
14
15# Traverse all subdirectories, excluding the template
16i=0
17for dir in */; do
18    if [ "$dir" == "$tempdir_name/" ]; then
19        continue
20    fi
21    if [ -f "$dir/$script_name" ]; then
22        echo "Executing $script_name in $dir..."
23        pushd "$dir" > /dev/null
24        ./$script_name
25        popd > /dev/null
26        ((i++))
27    fi
28done
29echo "Everything is executed: $i executions in total!"
30
Note: See TracBrowser for help on using the repository browser.