Thanks for your reply, Mike! Here's what I'm reading in the man page:
type [-aftpP] name [name ...] With no options, indicate how each name would be interpreted if used as a command name. If the -t option is used, type prints a string which is one of alias, keyword, function, builtin, or file if name is an alias, shell reserved word, function, builtin, or disk file, respectively. If the name is not found, then nothing is printed, and an exit status of false is returned. If the -p option is used, type either returns the name of the disk file that would be executed if name were speci- fied as a command name, or nothing if ``type -t name'' would not return file. The -P option forces a PATH search for each name, even if ``type -t name'' would not return file. If a command is hashed, -p and -P print the hashed value, not necessarily the file that appears first in PATH. If the -a option is used, type prints all of the places that contain an executable named name. This includes aliases and functions, if and only if the -p option is not also used. The table of hashed commands is not consulted when using -a. The -f option suppresses shell func- tion lookup, as with the command builtin. type returns true if any of the arguments are found, false if none are found. I can see that you're interpreting the last sentence to mean: type -p NAME found NAME and therefore it returned true. But since it was not a "file" (according to type -t NAME), then it didn't print anything. Maybe this is the only distinction between -p and -P (it's hard to tell because of the way it's worded)? If so, then it would be clearer to state it directly with something like: The -P option is like the -p option. However the -P option returns true iff ``type -t name'' would print ``file'', whereas the -p option returns true iff ``type -t name'' would return true. Is there any other distinction between -p and -P? It certainly surprised me to see that -p printed nothing but returned true. Was that the reason -P was created -- to bring the return value in line with the output? Thanks! -- John Wiersba > -----Original Message----- > From: Mike Frysinger [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 04, 2007 12:25 PM > To: bug-bash@gnu.org > Cc: Wiersba, John (TH USA) > Subject: Re: type -p return status is 0 if alias found > > On Tuesday 03 April 2007, [EMAIL PROTECTED] wrote: > > "type -p CMD" normally has a non-zero return status if CMD is not > > found. But if CMD is an alias, the return status is zero > even though > > nothing is printed to stdout. > > by definition, this is how -p is supposed to work ... my > guess is you want -P > -mike > _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash