From 06d4b337565a043816dc736bc768a38a7cbdc23c Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 10 Mar 2022 08:55:04 +0200 Subject: [PATCH] Refactoring / code cleanup. See: * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well. --- fortune-mod/datfiles/data/rules-of-acquisition-gen.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fortune-mod/datfiles/data/rules-of-acquisition-gen.sh b/fortune-mod/datfiles/data/rules-of-acquisition-gen.sh index 37543a9..c262337 100644 --- a/fortune-mod/datfiles/data/rules-of-acquisition-gen.sh +++ b/fortune-mod/datfiles/data/rules-of-acquisition-gen.sh @@ -16,15 +16,15 @@ footer_template="%%" line_maxlen=78 # Check command line -if [ $# -ne 2 ] -then - echo "Usage: ${0##*/} INFILE OUTFILE" - exit 2 -fi infile="$1" shift outfile="$1" shift +if test "$#" -ne 0 +then + echo "Usage: $0 INFILE OUTFILE" + exit 2 +fi # Convert CSV to DAT + wrap long lines + remove trailing whitespace while IFS="${csv_delimiter}" read -r number rule source -- 2.50.1