updated git and svn scripts
[xrzperl.git] / cmdinfo
blob239db93adb22a10f247e68929e18aa977b3b2c7e
1 #!/usr/bin/perl -w
2 ###APPNAME: cmdinfo
3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Fri Sep 21 22:33:33 2007
5 ###APPVER: 0.1
6 ###APPDESC: show cmd related information,output it's location
7 ###APPUSAGE: (cmdname)
8 ###APPEXAMPLE: cmdinfo perl
9 ###APPOPTION:
10 use strict;
11 $ARGV[0]="--help" unless(@ARGV);
12 exit 0 unless(system("plhelp",$0,(@ARGV)));
14 my $cmdname=shift;
15 my $location=`which "$cmdname"`;
16 chomp($location);
17 die("Command $cmdname not found in PATH\n") unless($location);
18 my $info=`file -biL "$location"`;
19 chomp($info);
20 $info =~ s/,.*$//g;
22 my $format="%-15s%s\n";
23 printf ($format,"Name:",$cmdname);
24 printf ($format,"FileType:",$info);
25 printf ($format,"Location:",$location);
26 printf ($format,"LinkTo:",readlink($location)) if(-l $location);