1
當myscript
與以下參數失敗,錯誤255(下同)傳遞的參數檢查數的KSH腳本參數
if [ ${#} -ne 7 ]
echo ${#} // Actually prints 7
then
echo "ERROR 255: Must provide the following 7 parameters:
one two three four five six seven"
exit 255
fi
所以
1 2 3 4 5 6 7
myscript value value /my/path/to/file my_file /tmp/ value value
檢查數量執行...如果號碼不是7,退出,但確實告訴號碼是什麼.. 7.
世界已經瘋了嗎? :)