More bbsh design notes.
Rob Landley
rob at landley.net
Sun Sep 10 21:40:02 UTC 2006
According to bloatcheck, enabling the minimal configuration of bbsh (with no
sub-features) currently adds 583 bytes to busybox. I think I can live with
that.
I'm planning to add bbsh to menuconfig (well, check in the changes I've made
locally anyway) once it can replace lash. I.E. lash comes out of the tree at
the same time bbsh goes in. (I'm not counting checking in shell/bbsh.c,
that's just for history tracking. I don't expect anybody but me to actually
use it yet.)
The real trick is getting everything configurable, so you can chop it down
under 600 bytes if all you want is something to run a few commands in your
init script. Here's what I've got so far:
Feature list for bbsh (nesting indicates sub-features):
Terminal Control
History (count)
Save on disk (count)
Tab completion
Pipes/redirect ( < << > >> | || & && () ; )
Flow control (if while for functions {})
Job Control (& fg bg jobs +tty=ctrl-z)
quotes "" ''
Wildcards (globbing: * ? {})
Backticks ( `` +envvars=$(blah))
Environment variables ($blah, ${blah}, =, export)
Local variables (set, local)
Synthetic environment variables (reorganize this:)
$*, $@, $1 - $9
Fancy prompts ($PS1, $PS2, $GAMECUBE).
+quotes=$IFS
+pipes=$_
+jobctl=$$ $? $PPID
+tty=$COLUMNS $LINES
$RANDOM
$PWD
$UID $EUID $GROUPS
$HOSTNAME $HOSTTYPE
+history=$HISTSIZE
$IFS $PATH $TERM )
$[] $(())
Arrays (${blah[blah]}
Advanced (${blah/blah/blah} ${blah:#:#})
Builtin functions
alias, exec, help, jobs, export, source, read (-nst), set/unset, fgbg
Some of that's automatic (for example, if you enable pipes and synthetic
environment variables, you get $_. It's not a separate config option.)
Others I haven't got a clue about. (Should aliases be their own config
option, or grouped with something else...)
Anyway, random snapshost of the thinking process...
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list