From c01ae4951aea1eab3466a3f469fed37d97cd4cc2 Mon Sep 17 00:00:00 2001 From: Yuki Adachi Date: Sat, 6 May 2023 10:12:52 +0900 Subject: [PATCH] USAGE uses STDERR --- mongodb/create-start.sh | 12 +++++++++++- mongodb/create.sh | 2 +- mysql/create-start.sh | 12 +++++++++++- mysql/create.sh | 2 +- postgresql/create-start.sh | 13 ++++++++++++- postgresql/create.sh | 2 +- redis/create-start.sh | 12 +++++++++++- redis/create.sh | 2 +- 8 files changed, 49 insertions(+), 8 deletions(-) diff --git a/mongodb/create-start.sh b/mongodb/create-start.sh index fefe4bc..878d085 100755 --- a/mongodb/create-start.sh +++ b/mongodb/create-start.sh @@ -24,7 +24,17 @@ currentDir="$( pwd -P )" cd $currentDir -./create.sh -f "$format" $1 $2 $3 > /dev/null +if [ $# -eq 0 ]; then + cat <<_EOT_ >&2 +usage : $currentDir/create.sh {Name} {MongodbVersion} {Port} +e.g. : $currentDir/create.sh mongo4-foo 4.4.10 27017 +e.g. : $currentDir/create.sh mongo5-bar 5.0.3 37017 +e.g. : $currentDir/create.sh mongo5-baz 5.0.3 random +_EOT_ + exit 1 +fi + +./create.sh -f "$format" $1 $2 $3 > /dev/null set -eu ./start.sh -f "$format" $1 diff --git a/mongodb/create.sh b/mongodb/create.sh index a7b6c3f..a6cee1b 100755 --- a/mongodb/create.sh +++ b/mongodb/create.sh @@ -27,7 +27,7 @@ currentDir="$( cd $currentDir if [ $# -eq 0 ]; then - cat <<_EOT_ + cat <<_EOT_ >&2 usage : $currentDir/create.sh {Name} {MongodbVersion} {Port} e.g. : $currentDir/create.sh mongo4-foo 4.4.10 27017 e.g. : $currentDir/create.sh mongo5-bar 5.0.3 37017 diff --git a/mysql/create-start.sh b/mysql/create-start.sh index fefe4bc..c667c3f 100755 --- a/mysql/create-start.sh +++ b/mysql/create-start.sh @@ -24,7 +24,17 @@ currentDir="$( pwd -P )" cd $currentDir -./create.sh -f "$format" $1 $2 $3 > /dev/null +if [ $# -eq 0 ]; then + cat <<_EOT_ >&2 +usage : $currentDir/create.sh {Name} {MysqlVersion} {Port} +e.g. : $currentDir/create.sh mysql5-foo 5.7.31 13306 +e.g. : $currentDir/create.sh mysql8-bar 8.0.30 23306 +e.g. : $currentDir/create.sh mysql8-baz 8.0.30 random +_EOT_ + exit 1 +fi + +./create.sh -f "$format" $1 $2 $3 > /dev/null set -eu ./start.sh -f "$format" $1 diff --git a/mysql/create.sh b/mysql/create.sh index 3a691ea..8c88a27 100755 --- a/mysql/create.sh +++ b/mysql/create.sh @@ -27,7 +27,7 @@ currentDir="$( cd $currentDir if [ $# -eq 0 ]; then - cat <<_EOT_ + cat <<_EOT_ >&2 usage : $currentDir/create.sh {Name} {MysqlVersion} {Port} e.g. : $currentDir/create.sh mysql5-foo 5.7.31 13306 e.g. : $currentDir/create.sh mysql8-bar 8.0.30 23306 diff --git a/postgresql/create-start.sh b/postgresql/create-start.sh index fefe4bc..4752c24 100755 --- a/postgresql/create-start.sh +++ b/postgresql/create-start.sh @@ -24,7 +24,18 @@ currentDir="$( pwd -P )" cd $currentDir -./create.sh -f "$format" $1 $2 $3 > /dev/null +if [ $# -eq 0 ]; then + cat <<_EOT_ >&2 +usage : $currentDir/create.sh {Name} {PostgresqlVersion} {Port} +e.g. : $currentDir/create.sh pg124-foo 12.4 54321 +e.g. : $currentDir/create.sh pg126-bar 12.6 54322 +e.g. : $currentDir/create.sh pg132-baz 13.2 54323 +e.g. : $currentDir/create.sh pg132-qux 13.2 random +_EOT_ + exit 1 +fi + +./create.sh -f "$format" $1 $2 $3 > /dev/null set -eu ./start.sh -f "$format" $1 diff --git a/postgresql/create.sh b/postgresql/create.sh index 837d3a9..34dd02b 100755 --- a/postgresql/create.sh +++ b/postgresql/create.sh @@ -27,7 +27,7 @@ currentDir="$( cd $currentDir if [ $# -eq 0 ]; then - cat <<_EOT_ + cat <<_EOT_ >&2 usage : $currentDir/create.sh {Name} {PostgresqlVersion} {Port} e.g. : $currentDir/create.sh pg124-foo 12.4 54321 e.g. : $currentDir/create.sh pg126-bar 12.6 54322 diff --git a/redis/create-start.sh b/redis/create-start.sh index fefe4bc..0179f60 100755 --- a/redis/create-start.sh +++ b/redis/create-start.sh @@ -24,7 +24,17 @@ currentDir="$( pwd -P )" cd $currentDir -./create.sh -f "$format" $1 $2 $3 > /dev/null +if [ $# -eq 0 ]; then + cat <<_EOT_ >&2 +usage : $currentDir/create.sh {Name} {RedisVersion} {Port} +e.g. : $currentDir/create.sh redis60-bar 6.0.16 26379 +e.g. : $currentDir/create.sh redis62-baz 6.2.6 36379 +e.g. : $currentDir/create.sh redis62-qux 6.2.6 random +_EOT_ + exit 1 +fi + +./create.sh -f "$format" $1 $2 $3 > /dev/null set -eu ./start.sh -f "$format" $1 diff --git a/redis/create.sh b/redis/create.sh index 6c75e5b..c5a3e84 100755 --- a/redis/create.sh +++ b/redis/create.sh @@ -27,7 +27,7 @@ currentDir="$( cd $currentDir if [ $# -eq 0 ]; then - cat <<_EOT_ + cat <<_EOT_ >&2 usage : $currentDir/create.sh {Name} {RedisVersion} {Port} e.g. : $currentDir/create.sh redis60-bar 6.0.16 26379 e.g. : $currentDir/create.sh redis62-baz 6.2.6 36379