From: Bastian Dehn Date: Fri, 3 Jul 2026 12:26:28 +0000 (+0200) Subject: fix shellcheck issues albentohandy X-Git-Tag: v1.0.0^2~40 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=59c6f124717a8daa67a08596f8bca88878b58ff6;p=albentohandy.git fix shellcheck issues albentohandy --- diff --git a/albentohandy b/albentohandy index 28df819..2d8bb9a 100755 --- a/albentohandy +++ b/albentohandy @@ -38,7 +38,7 @@ cleanup_flac() || errlog "missing workdir could not cleanup" \ || return $? - find $workdir -name '*.flac' -exec rm {} \; + find "$workdir" -name '*.flac' -exec rm {} \; } cleanup_cover() @@ -49,12 +49,12 @@ cleanup_cover() || errlog "missing workdir could not cleanup" \ || return $? - find $workdir -name 'cover.txt' -exec rm {} \; + find "$workdir" -name 'cover.txt' -exec rm {} \; [ "$cover" == "false" ] \ || return 0 - find $WORKDIR -name 'cover.jpg' -exec rm {} \; + find "$workdir" -name 'cover.jpg' -exec rm {} \; } make_symlinks_to_work() @@ -63,14 +63,14 @@ make_symlinks_to_work() local workdir="$2" local musicpath="$3" - for album in $(cat $albumlist); do + while IFS= read -r album; do [ -d "$musicpath/$album" ] \ || errlog "directory $musicpath/$album does not exists" \ || return $? cp --recursive \ --symbolic-link \ - $musicpath/$album \ - $workdir \ + "$musicpath/$album" \ + "$workdir" \ || errlog "could not copy symlinks from $musicpath/$album" \ || return $? rsync --recursive \ @@ -80,11 +80,11 @@ make_symlinks_to_work() --owner \ --exclude="*.flac" \ --include="cover.jpg" \ - $musicpath/$album \ - $workdir \ + "$musicpath/$album" \ + "$workdir" \ || errlog "could not copy etc like cover" \ || return $? - done + done < "$albumlist" } load_config() @@ -93,7 +93,8 @@ load_config() || errlog "file $HOME/.albentohandy.conf does not exists" \ || return $? - source $HOME/.albentohandy.conf + # shellcheck disable=SC1091 + source "$HOME/.albentohandy.conf" } check_programms() @@ -111,6 +112,7 @@ execute_program() [ -f "$LIBS/$lib" ] \ || errlog "file $LIBS/$lib does not exists" \ || return $? + # shellcheck disable=SC1090 source "$LIBS/$lib" || return $? mkdir -p "$workdir" @@ -154,17 +156,18 @@ main() cover=false - while getopts "3cfg:hi:m:orw:" optname; do + while getopts "3cfho" optname; do case "$optname" in "3") format="mp3" ;; "c") cover=true ;; "f") format="flac" ;; "h") Usage && return 0 ;; "o") format="opus" ;; + "*") echo "unkwnon parameter" ;; esac done convert_process "$format" || return $$ } -main $* +main "$@"