0

私は bash スクリプトにかなり慣れていないので、このコードが機能しない理由がわかりません (はい、ググってみました)。

これが私のコードです:

if [ $usertype = normal ]
then
    commands[0]="hi" ; descriptions[0]="get greeted"
    commands[1]="test" ; descriptions[1] = "test"
elif [ $usertype = hacker ]
    commands[0]="hi" ; descriptions[0]="get greeted"
    commands[1]="test" ; descriptions[1] = "test"
fi

alias fhelp='
for ((i=0; i<=${commands[@]}; i++))
do
    printf '%s %s\n' "${commands[i]}" "${descriptions[i]}"
done'

何か案は?

前もって感謝します。

4

2 に答える 2