-1
當我寫參數時,他們應該在案件中檢查,然後添加到列表中,如果你在前面輸入-c參數應該是大寫,如果你鍵入-4參數應該出現4次如何結合案例和班次,並在bash中添加結果列表
#!/bin/bash
function forloop {
for each in naam
do
echo $naam zegt je dat...
echo ""
echo
let "x+=1"
done
}
function helper {
echo "use names only."
echo "if u type -c before a word then it wil be shown in capital"
echo "if u type -(number) before a word the word will be shown (number)times "
}
naam=null
x=0
while [ $x -le 4 ]
do
case $1 in
-c) echo "${2 ^^}";shift ;;
help) helper ;shift;naam=helper;;
-4) $1x-1
exit ;shift;;
esac
naam=" $1"
shift
forloop
done
exit
哪部分代碼導致您的問題? –
對於$ naam中的每一個,你都缺少'$'。我無法弄清楚你打算用'$ 1x-1'。 – Barmar