improved logging with additional if statement

This commit is contained in:
Felix Lohmeier 2017-03-01 22:59:30 +01:00
parent 7b6b9d528f
commit 676f422d1f
1 changed files with 82 additions and 79 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# openrefine-batch.sh, Felix Lohmeier, v0.6.1, 01.03.2017 # openrefine-batch.sh, Felix Lohmeier, v0.6.2, 01.03.2017
# https://github.com/felixlohmeier/openrefine-batch # https://github.com/felixlohmeier/openrefine-batch
# user input # user input
@ -9,7 +9,7 @@ if [ -z "$1" ]
exit 2 exit 2
else else
inputdir=$(readlink -f $1) inputdir=$(readlink -f $1)
if [ ! -z "${inputdir// }" ] ; then if [ -n "${inputdir// }" ] ; then
inputfiles=($(find -L ${inputdir}/* -type f -printf "%f\n" 2>/dev/null)) inputfiles=($(find -L ${inputdir}/* -type f -printf "%f\n" 2>/dev/null))
fi fi
fi fi
@ -19,7 +19,7 @@ if [ -z "$2" ]
exit 2 exit 2
else else
configdir=$(readlink -f $2) configdir=$(readlink -f $2)
if [ ! -z "${configdir// }" ] ; then if [ -n "${configdir// }" ] ; then
jsonfiles=($(find -L ${configdir}/* -type f -printf "%f\n" 2>/dev/null)) jsonfiles=($(find -L ${configdir}/* -type f -printf "%f\n" 2>/dev/null))
fi fi
fi fi
@ -37,7 +37,7 @@ if [ -z "$4" ]
exit 2 exit 2
else else
crossdir=$(readlink -f $4) crossdir=$(readlink -f $4)
if [ ! -z "${crossdir// }" ] ; then if [ -n "${crossdir// }" ] ; then
crossprojects=($(find -L ${crossdir}/* -maxdepth 0 -type d -printf "%f\n" 2>/dev/null)) crossprojects=($(find -L ${crossdir}/* -maxdepth 0 -type d -printf "%f\n" 2>/dev/null))
fi fi
fi fi
@ -140,6 +140,8 @@ echo ""
done done
fi fi
# transform and export files
if [ -n "$jsonfiles" ] || [ "$export" = "export-true" ]; then
echo "=== TRANSFORM / EXPORT ===" echo "=== TRANSFORM / EXPORT ==="
echo "" echo ""
@ -221,6 +223,7 @@ if [ "$export" = "export-true" ]; then
wc -c -l ${outputdir}/*.tsv wc -c -l ${outputdir}/*.tsv
echo "" echo ""
fi fi
fi
# cleanup # cleanup
echo "cleanup..." echo "cleanup..."