getopts
getopts を久しぶりに使ってみたのでメモ書き。(時間たつと忘れます。。以下のような感じで getopts を使うことができます。少々荒いですが、、
1 #!/bin/sh
2
3 ECHO=/usr/bin/echo
4 CAT=/usr/bin/cat
5
6 ####################
7 # helpmsg function
8 ####################
9 helpmsg(){
10 ${CAT}<while の以下の箇所ですが。
15 while getopts x:ln:o:p: opt
:(コロン)がついていると、引数を必要とする。という意味になります。以下を見てみるとわかりますが、 -l の時はエラーがでません。
$ sh getopts_test.sh
Usage: getopts_test.sh -x exec$ sh getopts_test.sh -x exec
hogehoge!!!$ sh getopts_test.sh -x
getopts_test.sh: option requires an argument -- x
help message!$ sh getopts_test.sh -x exec -l
hogehoge!!!
PostgreSQL の ホットスタンバイは、ただ今pgpoolとの連携テスト中です。終わり次第書いていきます。。