refactoring

This commit is contained in:
Simon Vieille 2021-04-27 12:08:17 +02:00
parent a4a4744241
commit 4f5c85dbcc

View file

@ -24,7 +24,7 @@ error() {
exit 1 exit 1
} }
exit_if_empty() { exitIfEmpty() {
if [ -z "$1" ]; then if [ -z "$1" ]; then
error "$2" error "$2"
fi fi
@ -97,8 +97,8 @@ if [ $ERROR -eq 1 ]; then
error "Invalid parameter\\n$(usage)" error "Invalid parameter\\n$(usage)"
fi fi
exit_if_empty "$INPUT_FILE" "Input file is missing (-i)" exitIfEmpty "$INPUT_FILE" "Input file is missing (-i)"
exit_if_empty "$OUTPUT_FILE" "Output file is missing (-i)" exitIfEmpty "$OUTPUT_FILE" "Output file is missing (-i)"
if [ ! -f "$INPUT_FILE" ]; then if [ ! -f "$INPUT_FILE" ]; then
error "No such file: $INPUT_FILE" error "No such file: $INPUT_FILE"