[RFC PATCH v1 17/21] cli: hush_2021: Enable using \< and \> as string compare operators.

Simon Glass sjg at chromium.org
Wed Jan 12 21:03:40 CET 2022


Hi Francis,

On Fri, 31 Dec 2021 at 09:14, Francis Laniel
<francis.laniel at amarulasolutions.com> wrote:
>
> 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
> '\>'), so we stick here to this behavior.
> Also, 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.
>
> Signed-off-by: Francis Laniel <francis.laniel at amarulasolutions.com>
> ---
>  common/cli_hush_2021_upstream.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

We should add a file interface to U-Boot. Is that the only impediment
to implementing redirection? I thought the problem was lack of fork()
?

Regards,
Simon


More information about the U-Boot mailing list