From 7b243f97817537a8ab9381d73e2ad454a18a6ef1 Mon Sep 17 00:00:00 2001 From: TomasM Date: Sun, 20 Oct 2019 09:26:04 +0000 Subject: [PATCH] fix usage --- Slax/debian10/rootcopy/usr/bin/slax | 15 +++++++++++++-- Slax/debian9/rootcopy/usr/bin/slax | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Slax/debian10/rootcopy/usr/bin/slax b/Slax/debian10/rootcopy/usr/bin/slax index f7a8d60..a8843ad 100755 --- a/Slax/debian10/rootcopy/usr/bin/slax +++ b/Slax/debian10/rootcopy/usr/bin/slax @@ -51,7 +51,8 @@ activate() # check if file exists if [ ! -r "$SB" ]; then - usage "file not found $SB" + usage + die "file not found $SB" fi # check if the file is part of aufs union, if yes we need to copy it outside @@ -145,8 +146,18 @@ deactivate() } +usage() +{ + echo "Usage: $0 [ activate | deactivate | list ] [ file.sb ]" >&2 + if [ "$1" != "" ]; then + echo "$1" >&2 + fi +} + + if [ "$1" = "" ]; then - die "Usage: $0 [ activate | deactivate | list ] [ file.sb ]" + usage + die fi if [ "$1" = "activate" ]; then diff --git a/Slax/debian9/rootcopy/usr/bin/slax b/Slax/debian9/rootcopy/usr/bin/slax index f7a8d60..a8843ad 100755 --- a/Slax/debian9/rootcopy/usr/bin/slax +++ b/Slax/debian9/rootcopy/usr/bin/slax @@ -51,7 +51,8 @@ activate() # check if file exists if [ ! -r "$SB" ]; then - usage "file not found $SB" + usage + die "file not found $SB" fi # check if the file is part of aufs union, if yes we need to copy it outside @@ -145,8 +146,18 @@ deactivate() } +usage() +{ + echo "Usage: $0 [ activate | deactivate | list ] [ file.sb ]" >&2 + if [ "$1" != "" ]; then + echo "$1" >&2 + fi +} + + if [ "$1" = "" ]; then - die "Usage: $0 [ activate | deactivate | list ] [ file.sb ]" + usage + die fi if [ "$1" = "activate" ]; then