Isso é abordado na expansão de variável :
${parameter:?word}
If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of parameter is substituted.
Portanto, se não houver argument com a execução do script, a variável cmd se tornará help e será gravada como padrão e retornará ao shell.
No entanto, é apenas lido e não executado. Se você rodear com backticks, então ele será executado e executado a função Usage:
help() {
echo "Usage: $0 {build|upload|log}"
}
cmd=${1:? 'help'}
Infelizmente, isso ainda apresentará o stderr, como a expansão da variável foi projetada.
Você pode, alternativamente, fazer o seguinte:
cmd=${1:-help}
$cmd