I have a small bash file that when I run it, several empty files appear after the script is ran.
The file contains several records:
Release 438
Release 448
Release 453
Release 466
When done, the directory has 5 new files,
000
438
448
453
466
Code:
#!/bin/bash
#
# This sub will check if a parm is numeric
# (Note: $1 here is not $1 in main routine
#
isnum() {
awk -v a="$1" 'BEGIN {print (a == a + 0)}';
}
#
# Extract last build number BBB from "Release BBB" format
#
BMAX=000
while read dname
do
if [[ ! -z "$dname" ]]; then
bnum=`echo $dname | cut -f 2 -d " "`
if [[ `isnum "$bnum"` == "1" ]]; then
if [ "$bnum" > "$BMAX" ]; then
BMAX=$bnum
fi
fi
fi
done < /tmp/releasedirectories.txt