Add 'true' and 'false' commands

These commands are only enabled when the hush shell is enabled and can
be useful in scripts such as:

while true do
    echo "Booting OS...";
    run $bootcmd;
    echo "Booting OS failed";
    sleep 10;
done

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
master
Peter Tyser 15 years ago committed by Wolfgang Denk
parent 4e1ca93b6b
commit 396fd17338
  1. 22
      common/cmd_test.c

@ -149,3 +149,25 @@ U_BOOT_CMD(
"minimal test like /bin/sh",
"[args..]"
);
int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return 1;
}
U_BOOT_CMD(
false, CONFIG_SYS_MAXARGS, 1, do_false,
"do nothing, unsuccessfully",
NULL
);
int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
return 0;
}
U_BOOT_CMD(
true, CONFIG_SYS_MAXARGS, 1, do_true,
"do nothing, successfully",
NULL
);

Loading…
Cancel
Save