Date: Tue, 11 Sep 2018 09:44:01 -0400 From: Chet Ramey <chet.ra...@case.edu> Message-ID: <daaa7339-d32c-e5d1-46ce-e2afeeee3...@case.edu>
| There is prior art here. The group has simply chosen not to standardize | `type -t'. Oh, this is too good - you'd almost think it was a setup (it wasn't...) OK, so we have the problem, and the solution - which as best I can tell is implemented only by bash right? So not standardising it would be the correct (non-)action. However, for people like me, who have a need for the functionality, and desire to implement something, having to hunt around through every other shell, trying random stuff, or hoping to find the right place in their doc (where "not found" might just mean "didn't look in the right place") it would be really good to have a place where things like this can be located, so there can be more implementations, and eventual widespread use and standardisation. I think the NetBSD sh is about to become the second shell to add type -t (and perhaps type -a, at least in the type -at form) but probably not (all) the other options bash supports. Pity that (even then) I won't be able to rely upon it, as almost no-one else has copied it (I'd guess, at least half because of lack of knowledge.) I was using just "type name" and trying to find "builtin" in the various forms I have seen used, which worked for me, only to be told that ist eine von der Shell mitgelieferte Funktion wasn't recognised by my script as meaning builtin. I wonder why? I know that forcing the locale solves that issue, but the script is still guessing, as there's no defined output format. kre ps: I think we need to slightly adjust the definition of "type -t" (or perhaps add a new option) as ... jinx$ type -at foo printf echo bar function builtin file builtin file jinx$ type -at foo printf echo bar function builtin file builtin file Those look as if they're identical, but they're not. Both exited with an error status (there is no "bar") but in the first it is "foo" that is the function, in the second it is "printf" (and there is, also, no "foo") Without other guidance, I think I'd change the output format when there is more than one name arg to include the relevant name, otherwise allowing multiple names is useless (so another option would be to only permit one name with -a - or at least with -at). It might also be useful to distinguish the special builtins from the others... jinx$ type -t break echo builtin builtin makes them look just the same. Are changes to bash in this area possible?