#!/bin/sh show_usage() { #適当に使用方法を記述する。以下はヒアドキュメントを使った一例。 cat <<EOS # @(#) This script is ver 1.0 <=@(#)はwhatコマンドに対応 # "Usage: $0 [-optionA] [-optionB] arg1" # "Description: このスクリプトに関する説明" EOS } while getopts a:b:h OPT #optionに:があると、引数が有るという意味(※) do case $OPT in a) settingsA=$OPTARG ;; b) settingsB=$OPTARG ;; h) show_usage ;; ¥?) echo "未定義のオプションです。" show_usage ;; esac done