diff options
author | Francis Laniel <francis.laniel@amarulasolutions.com> | 2023-12-22 22:02:38 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-12-28 12:02:56 -0500 |
commit | d8b256308d2134ffe8704f26309897ebb9b56b64 (patch) | |
tree | 15303acb86251c5b11680c865df8f07e34167e2f /common/cli_hush_modern.c | |
parent | 410e78df06372507d1b836d8d825d3e3cdd11e93 (diff) |
cli: hush_modern: Enable using < and > as string compare operators
In Busybox hush, '<' and '>' are used as redirection operators.
For example, cat foo > bar will write content of file foo inside file bar.
In U-Boot, we do not have file system, so we can hardly redirect command output
inside a file.
But, in actual U-Boot hush, these operators ('<' and '>') are used as string
compare operators.
For example, test aaa < bbb returns 0 as aaa is before bbb in the dictionary.
Busybox hush also permits this, but operators need to be escaped ('\<' and
'\>').
Indeed, if escaping is needed it permits the developer to think about its code,
as in a lot of case, we want to compare integers (using '-lt' or '-gt') rather
than strings.
As testing in U-Boot is handled by the test command, we will stick with the
original behaviour and not adapt to Busybox one.
Nonetheless, if one day we decide to implement test with '[[ ]]', we will then
stick to upstream Busybox behavior.
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cli_hush_modern.c')
0 files changed, 0 insertions, 0 deletions