chill wrote: > > Anyone know how I can check for these built-in commands from within a > script? What makes them 'built-in' - is it some default shell > configuration? Could I manually load that configuration at the start of > the script, so that even if these built-in commands aren't available to > udev they would be to the script?
I can probably help with this. I used to contribute patches and bug fixes to busybox pretty often -- we were using it in an embedded product I was working on. First, there are two kinds of "built in" with regards to the shell. All shells (ash, bash, zsh, csh) have some number of commands that are implemented internally to the shell. "cd", for instance, couldn't be done by an external program -- the external program would change directroy, and exit, and leave the shell where it always was. So "cd", "alias", "bg", fg", "read", etc are always built-in, because they have to be. "echo" and "kill" don't have to be, but for efficiency they usually are. echo is built-in for efficiency, kill is built in because it can be smarter if it is. Note that just because a command like echo or kill is built-in to the shell, it doesn't mean there isn't also a regular program by that name in the filesystem. Try "type -a echo" or "type -a kill" at a bash prompt, for instance. That lets other programs besides the shell run them if they need to. All of the above is true with or without busybox. Busybox adds another layer of "builtin-ness". When two programs are compiled (like "mv" and "cat", say) they end up containing a lot of redundant code. Even if they both use shared libraries for things like printf, or for reading and writing files, they still each have their own argument parsing, their own usage message, maybe some other common code idioms. If you took mv.c and cat.c and merged them into one executable called "twoprogs", you could imagine that "twoprogs" might be smaller than the sum of the sizes of the separate mv and cat. And you could still get with behavior with "twoprogs mv file1 file2" or "twoprogs cat file". Busybox is a merge like that, of a whole lot of programs. Do an "ls -l /sbin /bin /usr/bin | less" on a pcp box, and/or type "buybox --help" to get a list of all of the programs that are merged into one. And now, back to your problem: if awk isn't working without a full path, or pgrep isn't working without "busybox pgrep", it's really unlikely to be busybox's fault. busybox is a very mature program (I worked on it over 10 years ago), and is really unlikely to have the problems you're describing. (awk, for instance, isn't part of busybox -- it's an extension, I believe.) I'll stop now. paul ------------------------------------------------------------------------ pgf's Profile: http://forums.slimdevices.com/member.php?userid=58510 View this thread: http://forums.slimdevices.com/showthread.php?t=113661 _______________________________________________ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix