From 08483c6330fe61399a87263df3df49b123e5e204 Mon Sep 17 00:00:00 2001 From: fabian Date: Fri, 24 Feb 2023 16:10:42 +0100 Subject: [PATCH] reworked parameter handling --- scripts/upContainers.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/upContainers.sh b/scripts/upContainers.sh index 00d2afe..b709db8 100755 --- a/scripts/upContainers.sh +++ b/scripts/upContainers.sh @@ -1,19 +1,23 @@ #!/usr/bin/env bash set -euo pipefail -if [[ $# > 0 ]]; then - DOCKER_ROOT=$1; -else - DOCKER_ROOT=$(pwd); -fi -# echo $DOCKER_ROOT; +# evaluate options through given arguments +docker_root= +while [[ $# > 0 ]]; do + case $1 in + -d | --dir) docker_root=$2; shift 2;; + * ) break ;; # Anything else stops command line processing. + esac +done -for subdir in $DOCKER_ROOT/*; do - if [[ !(-d $subdir) || ${subdir##*/} == "matrix_synapse" || ${subdir##*/} == "pydio_cells" || ${subdir##*/} == "mattermost" ]]; then +if [[ -z $docker_root ]]; then + docker_root=~/docker; +fi + +for subdir in $docker_root/*; do + if [[ !(-d $subdir) ]]; then continue; fi - # echo $subdir; cd $subdir; - # echo $(pwd); docker-compose up -d; done