bin: Use assertion-style condition checks

This commit is contained in:
Richard Hansen 2020-05-14 17:36:16 -04:00
parent 5462d2109c
commit a28b7c7595
3 changed files with 8 additions and 22 deletions

View file

@ -33,22 +33,16 @@ if [ -d "../bin" ]; then
fi
# Check if a logfile parameter is set
if [ -z "${LOG}" ]; then
fatal "Set a logfile as the first parameter"
fi
[ -n "${LOG}" ] || fatal "Set a logfile as the first parameter"
shift
while [ 1 ]
do
# Try to touch the file if it doesn't exist
if [ ! -f ${LOG} ]; then
touch ${LOG} || fatal "Logfile '${LOG}' is not writeable"
fi
[ -f ${LOG} ] || touch ${LOG} || fatal "Logfile '${LOG}' is not writeable"
# Check if the file is writeable
if [ ! -w ${LOG} ]; then
fatal "Logfile '${LOG}' is not writeable"
fi
[ -w ${LOG} ] || fatal "Logfile '${LOG}' is not writeable"
# Start the application
bin/run.sh $@ >>${LOG} 2>>${LOG}