WH.PL - a Smarter 'which'
wh.pl ls rm # Looks for /.*ls.*/ and /.*rm.*/
wh.pl 'l[fc]s' # Looks for /l[fc]s/
wh.pl -exactly ls # Looks for /^ls$/
wh.pl -startswith ls # Looks for /^ls/
wh.pl -endswith ls # Looks for /ls$/
This program can be used to show executables on your PATH. Sometimes you remember PART of the name of an executable. You can use this program to show you all executables on your PATH with the executable name partially specified.
This program should work on either Unix or DOS systems where Perl is installed.
Use Perl regular expressions with a program name to find executables on the path. Don't forget, you may need to escape special characters so the shell will not expand them. E.g. wh.pl 'l[fc]s'
On Unix systems in addition to your normal PATH, the program will search in /sbin and /usr/sbin to find executables that might be on the system admin PATH, but not your PATH.
The default action is to show any executable whose name contains the string you provide. For instance, 'wh.pl ls' would find all programs which have the characters 'ls' in the name (quite a long list typically). This would include 'ls', 'lsmod', and 'filelsize' as examples.
On DOS systems, the program will look for executables with these extensions: 'exe', 'com', 'bat', 'dll', and 'pl'. On a DOS system, the command 'wh.pl ls' might find 'ls.exe' or 'ls.bat' among other possibilities.
If no fatal errors are detected, the program exits with a return code of 0.
Written by Terry Gliedt <firstname.lastname@example.org> in 1994-2003. This 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; See http://www.gnu.org/copyleft/gpl.html