From b73c27f3e246d78bea924e0a968777bf5d128537 Mon Sep 17 00:00:00 2001 From: dimti Date: Sat, 4 Jul 2020 19:48:59 +0300 Subject: [PATCH] move databases option to script args --- _config.sh | 1 - start-replication.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/_config.sh b/_config.sh index 4a5afdb..bb5d822 100644 --- a/_config.sh +++ b/_config.sh @@ -1,3 +1,2 @@ #!/bin/bash log_file=replication.log -databases=( 'database_one' 'another_database' ) diff --git a/start-replication.sh b/start-replication.sh index 3ae8280..bc173cb 100755 --- a/start-replication.sh +++ b/start-replication.sh @@ -6,6 +6,33 @@ set -a . "${CONFIG_FILE}" set +a +readopt='getopts $opts opt;rc=$?;[ $rc$opt == 0? ]&&exit 1;[ $rc == 0 ]||{ shift $[OPTIND-1];false; }' + +opts=vfdo: + +# Enumerating options +#while eval $readopt +#do +# echo OPT:$opt ${OPTARG+OPTARG:$OPTARG} +#done + +# Enumerating arguments +databases=( ) + +for arg +do + databases=( $databases $arg ) +done + +if [[ -z "$databases" ]]; then + cat <