version.pl (1257B)
1 #!/usr/sbin/perl 2 # 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 # Compose lowercase alphabet 8 @alphabet = ( "a", "b", "c", "d", "e", "f", "g", "h", 9 "i", "j", "k", "l", "m", "n", "o", "p", 10 "q", "r", "s", "t", "u", "v", "w", "x", 11 "y", "z" ); 12 13 # Compute year 14 $year = (localtime)[5] + 1900; 15 16 # Compute month 17 $month = (localtime)[4] + 1; 18 19 # Compute day 20 $day = (localtime)[3]; 21 22 # Compute base build number 23 $version = sprintf( "%d%02d%02d", $year, $month, $day ); 24 $directory = sprintf( "%s\/%s\/%d%02d%02d", $ARGV[0], $ARGV[1], $year, $month, $day ); 25 26 # Print out the name of the first version directory which does not exist 27 #if( ! -e $directory ) 28 #{ 29 print $version; 30 #} 31 #else 32 #{ 33 # # Loop through combinations 34 # foreach $ch1 (@alphabet) 35 # { 36 # foreach $ch2 (@alphabet) 37 # { 38 # $version = sprintf( "%d%02d%02d%s%s", $year, $month, $day, $ch1, $ch2 ); 39 # $directory = sprintf( "%s\/%s\/%d%02d%02d%s%s", $ARGV[0], $ARGV[1], $year, $month, $day, $ch1, $ch2 ); 40 # if( ! -e $directory ) 41 # { 42 # print STDOUT $version; 43 # exit; 44 # } 45 # } 46 # } 47 #}