aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2021-02-28 16:29:51 -0500
committerTom Rini <trini@konsulko.com>2021-04-12 17:17:11 -0400
commit9539f71675c40485e448efb3c4e06afc8d102f94 (patch)
treee4a3d2be937c6593a057e8a8a077645f2af09d40 /test
parentc146de48727da66ea7dc43f12bd41814cff2faa8 (diff)
downloadu-boot-9539f71675c40485e448efb3c4e06afc8d102f94.zip
u-boot-9539f71675c40485e448efb3c4e06afc8d102f94.tar.gz
u-boot-9539f71675c40485e448efb3c4e06afc8d102f94.tar.bz2
hush: Fix assignments being misinterpreted as commands
If there were no variable substitutions in a command, then initial assignments would be misinterpreted as commands, instead of being skipped over. This is demonstrated by the following example: => foo=bar echo baz Unknown command 'foo=bar' - try 'help' Signed-off-by: Sean Anderson <seanga2@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/cmd/test_echo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c
index 9d60d7d..091e4f8 100644
--- a/test/cmd/test_echo.c
+++ b/test/cmd/test_echo.c
@@ -34,6 +34,8 @@ static struct test_data echo_data[] = {
*/
{"setenv jQx X; echo \"a)\" ${jQx} 'b)' '${jQx}' c) ${jQx}; setenv jQx",
"a) X b) ${jQx} c) X"},
+ /* Test shell variable assignments without substitutions */
+ {"foo=bar echo baz", "baz"},
/* Test handling of shell variables. */
{"setenv jQx; for jQx in 1 2 3; do echo -n \"${jQx}, \"; done; echo;",
"1, 2, 3, "},