-
Notifications
You must be signed in to change notification settings - Fork 113
/
count_lines.sh
executable file
·38 lines (37 loc) · 1.1 KB
/
count_lines.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
#!/bin/bash
models="ED BRAMS Ramspost"
for model in ${models}
do
echo "========================================================================="
echo " + Model ${model}: "
echo " "
modellines=0
direcs=$(ls -1 ${model}/src)
for dir in ${direcs}
do
case "${dir}" in
test_cases|doc|preproc)
echo "Skip" >> /dev/null
;;
*)
echo -n " - Directory ${dir}: "
files=$(/bin/ls -1 ${model}/src/${dir}/*.F90 2> /dev/null)
files="${files} $(/bin/ls -1 ${model}/src/${dir}/*.f90 2> /dev/null)"
files="${files} $(/bin/ls -1 ${model}/src/${dir}/*.c 2> /dev/null)"
dirlines=0
for file in ${files}
do
nlines=$(sed '/^ *$/ d' ${file} | wc -l | awk '{print $1}')
let dirlines=${dirlines}+${nlines}
done
echo "${dirlines} lines"
let modellines=${modellines}+${dirlines}
;;
esac
done
echo " - Total: ${modellines}"
echo "========================================================================="
echo " "
echo " "
echo " "
done