#!/usr/bin/perl -w # # version - print out Solaris versions for given commands. Perl, Solaris. # # Can't remember which version of Solaris that command first appeared in? # version can help. # # 23-Jan-2006, ver 1.10 (check for updates, http://www.brendangregg.com) # # USAGE: version [-h] | command [command ...] # eg, # version devfsadm # version info for the devfsadm command # version ls cal vi # version info for multiple commands # # The database that version uses is within the program. It may be useful # to run grep on version itself. eg, # # grep 'Solaris 9' version # print what was new in Solaris 9 # # NOTE: This command is not written by Sun and some command entries may # not be perfect. See your Sun documentation. # # SEE ALSO: http://docs.sun.com # accurate and updated info on commands # # COPYRIGHT: Copyright (c) 2005 Brendan Gregg. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # (http://www.gnu.org/copyleft/gpl.html) # # Author: Brendan Gregg [Sydney, Australia] # # ToDo: # * Add pre Solaris history (SunOS and earlier). # * Add data for library searches (eg, "glib") # * Add data for feature searches (eg, "MPSS") # * Add more commands to improve hit rate. # # 23-Mar-2004 Brendan Gregg Created this. # 23-Mar-2005 " " Added Solaris 10. Happy Birthday version! # 23-Jan-2006 " " Tweaked code. use strict; usage() if (defined $ARGV[0] ? $ARGV[0] : "") =~ /^(-h|--help|)$/; ### Load Database my @Db = ; # read from the end of this program # # Main # foreach my $word (@ARGV) { my @Match = grep /^$word:/, @Db; if (@Match == 0) { printf STDERR "%-11s not found in database\n", $word; next; } foreach (@Match) { my @Fields = split /:/; printf "%-11s %-16s %-5s %s", @Fields[0,2..4]; } } # # Subroutines # sub usage { print STDERR <