CASE

Execute command based on string match

CASE

Run the command paired with the first value that equals <what>. After <what> come <value> <command> pairs. Values must match exactly, including case. A value of * matches anything, so put it last as the default. The result is that of the command that ran, or success if none matched. Quote each command, and quote <what> if it can be empty.

Whether it is safe depends on the commands. See Scripting.

Hardware-validated

drivshell> local x b
drivshell> case $x a "echo got a" b "echo got b" * "echo other"
got b

Built-in help

Parameters: <what> <value> <command> [<value> <command>]...
    Execute a command based on matching a key value.

Further reading

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), BCM_SDK命令.