From 29c7b3e72f71660941d3dfabfd95352ea03770bc Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Wed, 27 Oct 2021 20:13:51 -0300 Subject: [PATCH] Use POSIX shell constructs instead --- fsub | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fsub b/fsub index 76e25a0..c347849 100755 --- a/fsub +++ b/fsub @@ -12,14 +12,14 @@ usage() { [ -z "$1" ] && usage for arg in "$@"; do - if [ ! -f "$arg" ]; then - echo "$arg is not a file" - usage - fi - if [ "${arg: -4}" != ".srt" ]; then - echo "$arg is not a .srt file" - usage - fi + case "$arg" in + *.srt ) + if [ ! -f "$arg" ]; then + echo "$arg is not a file" + usage + fi ;; + *) echo "$arg is not a .srt file"; usage ;; + esac done [ -f "$FSUBRC" ] || touch $FSUBRC