forked from missirol/ParticleSwarmOptimization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runPSO_exe.sh
executable file
·54 lines (34 loc) · 982 Bytes
/
runPSO_exe.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
set -e
if [ "$#" -gt 1 ]; then
ODIR="$1"
else
printf "\n%s\n" " >>> ERROR -- invalid list of command-line argument(s):"
printf "%s\n" " [1] path to output directory"
printf "%s\n\n" " [2+] PSO configuration file(s)"
exit
fi
if [ -d "${ODIR}" ]; then
printf "\n%s\n\n" " >>> ERROR -- target output directory already exists: ${ODIR}"
exit
fi
###
for cfgfile in "${@:2}"; do
if [ ! -f "${cfgfile}" ]; then
printf "\n%s\n\n" " >>> WARNING -- target configuration file not found: ${cfgfile}"
continue
fi
if [ ! -d "${ODIR}" ]; then mkdir -p "${ODIR}"; fi;
if [[ ${cfgfile} != *_config.txt ]]; then continue; fi;
cfgname=$(basename "${cfgfile}")
cfgname="${cfgname%_config.txt}"
printf "%s\n" "> ${ODIR}/${cfgname}"
nohup ./runPSO.py \
-c "${cfgfile}" \
-o "${ODIR}"/"${cfgname}" \
>& "${ODIR}"/"${cfgname}".log &
unset -v cfgname
done
unset -v cfgfile
###
unset -v ODIR