From 7251f9d0920a432aa48d31adab442b2a7e67e554 Mon Sep 17 00:00:00 2001 From: Sem Date: Mon, 20 Jul 2026 13:52:10 +0200 Subject: [PATCH] Add proper parsing of help flag --- fix_unknown_album_and_artist_flac_file.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fix_unknown_album_and_artist_flac_file.sh b/fix_unknown_album_and_artist_flac_file.sh index 9ef3ca0..38d1595 100755 --- a/fix_unknown_album_and_artist_flac_file.sh +++ b/fix_unknown_album_and_artist_flac_file.sh @@ -32,15 +32,21 @@ function print_help() echo "\tThis is the same as running the script for each single file in the list" } +if [ -z "$1" ] + echo "use the -h flag to get help on how to use this script" + exit 0 +fi +if [ "$1" = "-h" ] + then + print_help + exit 0 +fi if [ -z "$2" ] then echo "staying in current directory" else - if [ "$1" = "-h" ] - then - print_help - exit 0 - elif [ "$1" = "-l" ] + + if [ "$1" = "-l" ] then echo "Looping through $2" while read flacfile; do