-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheckOutputFolder.sh
More file actions
executable file
·25 lines (22 loc) · 909 Bytes
/
checkOutputFolder.sh
File metadata and controls
executable file
·25 lines (22 loc) · 909 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
#Check correct number of command line arguments
if (( $# < 1 )); then
echo "Checks that the input filename and output folder name are the same (to ensure that output data are not written to the wrong place!)" >&2
echo "Usage : checkOutputFolder [inputfile name] " >&2
echo "Example: checkOutputFolder.sh N10TestRun.dat" >&2
exit 1
fi
filename=${1%.*}
s=$(sed '34q;d' $1)
foldername=$(echo $s | awk -F[//] '{print $2}')
echo "Testing if file and folder name match..."
echo $foldername " (Folder)"
echo $filename " (Input file name)"
if [ "$foldername" == "$filename" ];
then
echo "...they are the same."
else
echo ""
echo "**********************************************************************"
echo "!!!!!!!!!!!!!File and folder names do not match!!!!!!!!!!!!!!!!!!!!!!!"
echo "**********************************************************************"
fi