OSDN Git Service

[fix] : Fixed help message
authorhayao <hayao@fascode.net>
Sun, 23 May 2021 08:27:27 +0000 (17:27 +0900)
committerhayao <hayao@fascode.net>
Sun, 23 May 2021 08:27:27 +0000 (17:27 +0900)
tools/umount.sh

index 980091d..ee6517b 100755 (executable)
@@ -97,11 +97,6 @@ umount_work () {
 }
 
 
-# Check root.
-if (( ! "${EUID}" == 0 )); then
-    msg_error "This script must be run as root." "1"
-fi
-
 # Parse options
 OPTS=("d" "f" "h" "m:")
 OPTL=("debug" "force" "help" "maxdepth:")
@@ -128,7 +123,7 @@ while true; do
             shift 2
             ;;
         -h | --help)
-            _usage
+            _help
             exit 0
             ;;
         --)
@@ -137,11 +132,17 @@ while true; do
             ;;
         *)
             msg_error "Invalid argument '${1}'"
-            _usage 1
+            _help
+            exit 1
             ;;
     esac
 done
 
+# Check root.
+if (( ! "${EUID}" == 0 )); then
+    msg_error "This script must be run as root." "1"
+fi
+
 
 if [[ -z "${1+SET}" ]]; then
     msg_error "Please specify the target directory." "1"