On Wed, 15 Sep 2010, Nigel Kersten wrote: > Does 'type --all asdf' do the right thing on SunOS ?
According to IEEE Std 1003.1, 2004 Edition, "type" does not take any options. Anyway, on Solaris-5.8: for shell in /bin/sh /usr/xpg4/bin/sh /bin/ksh /usr/local/bin/bash ; do echo "[$shell]"; ${shell} -c 'type --all asdf; echo status=$?' ; done [/bin/sh] --all not found asdf not found status=1 [/usr/xpg4/bin/sh] asdf not found status=127 [/bin/ksh] asdf not found status=127 [/usr/local/bin/bash] /usr/local/bin/bash: line 0: type: asdf: not found status=1 On NetBSD-5.99.27: for shell in /bin/sh /bin/ksh /usr/pkg/bin/bash ; do echo "[$shell]"; ${shell} -c 'type --all asdf; echo status=$?' ; done [/bin/sh] type: Illegal option -- status=2 [/bin/ksh] /bin/ksh: whence: --: unknown option status=1 [/usr/pkg/bin/bash] /usr/pkg/bin/bash: line 0: type: asdf: not found status=1 I have seen systems where "type" prints a message about "command not found" (or words to that effect) but sets exit status 0 as if it had been successful. I have found that "command -v" does the right thing on the same system. Unfortunately, my notes from the time I noticed this don't say which system had the problem, but I think it was AIX or Cygwin. Compare the POSIX description of the exit status for "type" and "command" at <http://www.opengroup.org/onlinepubs/009695399/utilities/type.html> and <http://www.opengroup.org/onlinepubs/009695399/utilities/command.html>: For "type" exit status >0 means "an error occurred", while for "command" exit status >0 means "the command_name could not be found or an error occurred". What I take from the POSIX spec is that one could argue either way about whether or not it's an error for the "type" command to report that a target command does not exist; but for the "command -v" command it's clear that nonexistence of the target command should result in non-zero exit status. --apb (Alan Barrett) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.