[RFC PATCH 02/28] cli: Add LIL shell

Tom Rini trini at konsulko.com
Mon Jul 5 21:10:58 CEST 2021


On Sat, Jul 03, 2021 at 09:33:30PM +0200, Wolfgang Denk wrote:
> Dear Sean,
> 
> In message <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b at gmail.com> you wrote:
> >
> > > For a partial list, see
> > > 
> > > [1] https://github.com/Forty-Bot/lil/commits/master
> >
> > Whoops, looks like I completely misread what you were asking here. I
> > don't have an exhaustive list of differences, but here are some similar
> > things expressed in both languages:
> >
> > sh				tcl
> >
> > 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, I know TCL, and there has been a zillion of reasons to move
> _from_ that language many, many years ago.  Intoducing this as new
> "shell" language in U-Boot does not look attractive to me.
> Actually, it gives me the creeps.

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.

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.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210705/100bb9bd/attachment.sig>


More information about the U-Boot mailing list