diff --git a/s3h.sh b/s3h.sh index 0912edb..6e8344f 100755 --- a/s3h.sh +++ b/s3h.sh @@ -8,6 +8,13 @@ if [[ $# -eq 1 && -d "$1" ]]; then START_DIR="$1" fi +if [[ ! -d "$START_DIR" ]]; then + echo "start directory '$START_DIR' does not exist" >&2 + echo -e "either create or set 'start directory' parameter\n" >&2 + echo "Usage: $0 [start directory]" >&2 + exit 2 +fi + # select config file configFile='' while [[ -z "$configFile" ]]; do @@ -34,6 +41,14 @@ while [[ -z "$configFile" ]]; do para+=("$d" "$d") done + if [[ ${#para[@]} -eq 0 ]]; then + echo "no file or directory found in '$dir'" >&2 + echo "either create a connection file like" >&2 + echo -e "\ttouch '$dir/root@example.org'" >&2 + echo "or create a group by adding a directory" >&2 + exit 3 + fi + # run dialog ret=$("$DIALOG" --no-tags --stdout --menu "select connection" 0 0 0 ${para[@]} 2>&1) if [[ $? -ne 0 ]]; then