スクリプトは機能しますが、 "tmp"を使用せずに同じ結果を得る方法はありますか?変数を読み込み、関数内で引数として渡す別の方法
おかげ
function ask_version() {
while true ; do
echo -e "Give the version of" $1
local tmp=$2
read -r tmp
if [[ ! $tmp =~ ^[0-9]$ ]] ; then
echo -e "Please respect number format"
elif [[ $tmp -ne $t ]] ; then
echo -e "It is not the true number"
else
return 0
fi
done
}
ask_version "APP1" "APP1VERSION"
ask_version "APP2" "APP2VERSION"
変数の使用には何が問題なのですか? –
$ 2を使用してtmpを一緒に設定することはできませんか? –
@Raman $ 2を使用しようとしましたが動作しませんでした –