getopts
を使用して、シェルスクリプトにパラメータを渡しています。 たとえば、スクリプト内の2つのセクションで操作を行い、両方が同じ文字で始まるようにしたいとします。私は他の手紙を選びたくありません。たとえば、プロジェクト1とプロジェクト2という2つのプロジェクトがあり、どちらもpという文字で始まります。同じ開始アルファベットのgetoptsオプション
--project1
などの完全な文字列を提供できる方法はありますか他の解決方法はありますか?
while getopts "project1 project2" opt;
# This ofcourse would not work. So, whats the solution?
getopts
の代替手段はありますか?
可能な複製を(使用してスクリプトを呼び出しますhttps://stackoverflow.com/questions/402377/using- getopts-in-bash-shell-script-to-long-and-short-command-line-options) – yinnonsanders