[cmake-developers] Minor regression in --version results for CMake 2.8.12.1 (A FALSE ALARM)

Matthew Woehlke matthew.woehlke at kitware.com
Fri Dec 6 13:56:39 EST 2013


On 2013-12-06 03:28, Marcel Loose wrote:
> On 05/12/13 18:27, Matthew Woehlke wrote:
>> On 2013-12-05 02:36, Alan W. Irwin wrote:
>>> Sorry, this turned out to be a false alarm. Despite "which cmake"
>>> telling me I was using cmake-2.8.12.1 [snip]
>>
>> ...which is, of course, why you should always use "type" in bash
>> rather than "which" :-). "type", being a shell built-in, will tell you
>> what bash will *actually* run, hashing - and shell builtins, and
>> functions, and aliases - included.
>>
> Hmm, interesting. I didn't know the "type" command. However, is there a
> way to easily parse the output of "type"?

It depends what you're trying to do. Problems can arise because the 
"command" might be an alias, built-in, function, etc. and the correct 
thing to do is to report this (or if you're trying to parse the output 
e.g. in a script, your script should be prepared to handle this).

That said, some combination of inspecting the -p, -P and/or -t options 
will probably get you there. I'd strongly encourage you to read the 
output of 'help type' :-). 'type' with no options is mainly intended for 
humans to read.

-- 
Matthew




More information about the cmake-developers mailing list