
Dear Tom,
In message 20210705191058.GB9516@bill-the-cat you wrote:
foo=bar set foo bar echo $foo echo $foo
if [ 1 -gt 2 ]; then if {1 > 2} { echo a echo a else } { echo b echo b fi }
foo() { proc foo {first second} { echo $1 $2 echo $first $second } }
for file in $(ls *.c); do foreach file [glob *.c] { echo $file echo $file done }
fact() { if [ $1 -eq 0 ]; then echo 1 else echo $(($1 * $(fact $(($1 - 1))))) fi }
proc fact {n} { if {$n} { expr {$n * [fact [expr {$n - 1}]]} } { return 1 } }
Hopefully this gives you a bit of a feel for the basic differences.
Which of these things, from each column, can you do in the context of U-Boot? That's important too.
Well, with a current version of hush we can do:
-> foo=bar -> echo $foo bar
-> if [ 1 -gt 2 ]; then
echo a else echo b fi
b
-> foo() {
echo $1 $2 }
-> foo bar baz bar baz
-> for file in $(ls *.c); do
echo $file done
ls: cannot access '*.c': No such file or directory
-> fact() {
if [ $1 -eq 0 ]; then echo 1 else echo $(($1 * $(fact $(($1 - 1))))) fi }
-> fact 4 24
Oh, in the contect of U-Boot? Well, there are of course limitations, but not because of the shell, but because of the fact that we have no concept of files, for example.
But another command interpreter will not fix this.
This is I think the hard question. A draw of the current shell is that it it looks and acts like bash/sh/etc, for at least basic operations. That's something that's comfortable to a large audience. That has disadvantages when people want to start doing something complex. Sean has shown that several times and he's not the only one. LIL being tcl'ish is not.
Tcl is a horror of a language for anything that is above trivial level.
Do you really think that replacing standard shell syntax with Tcl is "something that's comfortable to a large audience"? I seriously doubt that.
Something that has "sh" syntax but also clear to the user errors when trying to do something not supported would also be interesting to see. It seems like a lot of the frustration from users with our shell is that it's not clear where the line between "this is an sh-like shell" and "no, not like that" is.
Did you run some tests on the version of hush as comes with recent busybox releases? Which of our user's requirements does it fail to meet?
Best regards,
Wolfgang Denk