From c9d16e53f6406c505418208435ddabcad4623e57 Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Fri, 18 Mar 2022 13:26:33 +0100 Subject: [PATCH] chore: put dispaly help in function --- EOPSY/task1/modify.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/EOPSY/task1/modify.sh b/EOPSY/task1/modify.sh index 0891771b..ca43b5fa 100755 --- a/EOPSY/task1/modify.sh +++ b/EOPSY/task1/modify.sh @@ -1,10 +1,15 @@ #!/bin/bash -while getopts ":h" option; do - echo "This script modifies file names" - echo "-l lowerize file names" - echo "-u uppercase file names" - echo "-r recurse into directory" - echo "[-r] specify sed pattern that will be executed on file names" - echo "-h show this help information" -done +show_help() { + local OPTIND + while getopts ":h" opt ; do + echo "This script modifies file names" + echo "-l lowerize file names" + echo "-u uppercase file names" + echo "-r recurse into directory" + echo "[-r] specify sed pattern that will be executed on file names" + echo "-h show this help information" + done +} + +show_help "$@"