pleroma_ctl: fix crashes due to different shift(1) behavior on dash
[akkoma] / rel / files / bin / pleroma_ctl
index 90f87a9909ed3960976019088645119c8958a917..87c486514008b84086e308efee4f7774cc85afad 100755 (executable)
@@ -140,12 +140,16 @@ else
        FULL_ARGS="$*"
 
        ACTION="$1"
-       shift
-
-       if [ "$(echo \"$1\" | grep \"^-\" >/dev/null)" = false ]; then
-               SUBACTION="$1"
+       if [ $# -gt 0 ]; then
                shift
        fi
+       echo "$1" | grep "^-" >/dev/null
+       if [ $? -eq 1 ]; then
+               SUBACTION="$1"
+               if [ $# -gt 0 ]; then
+                       shift
+               fi
+       fi
 
        if [ "$ACTION" = "update" ]; then
                update "$@"