-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforEachModel.sh
More file actions
executable file
·31 lines (27 loc) · 847 Bytes
/
Copy pathforEachModel.sh
File metadata and controls
executable file
·31 lines (27 loc) · 847 Bytes
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
#!/bin/bash
#run a command for each model (use that model as an arg)
if [[ -z $1 ]]; then
echo "provide a program to run on this model"
exit 0
fi
while read m; do
if [[ -z ${m} || ${m:0:1} == "#" ]]; then #this line is a comment or blank
continue;
fi
if [[ ${m:0:1} == "-" ]]; then
continue;
fi
m=`echo ${m} | cut -d# -f1 | cut -d' ' -f1` #remove trailing comment and whitespace
if [[ ${m:0:1} != [a-zA-Z] && ${m:0:1} != "-" ]]; then #malformed model definition file, model should only begin with a letter
echo "this model definition file is malformed, exiting."
echo " \'${m}\' "
exit -1
fi
echo "execing ${@} ${m}"
${@} ${m}
#if [[ ${SHELL} ]]; then
# ${SHELL} -c "${@} ${m}"
##else
# bash -c "${@} ${m}"
#fi
done < models.txt