WH.PL - a Smarter 'which'

Download this program

SYNOPSIS

        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$/

DESCRIPTION

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.

OPTIONS

-debug
Enables debugging to show you where it is searching. Additionally it will also tell you about directories that are missing in your PATH.

-endswith
Indicates the the program name 'ends with' the name provided. Specifying '-endswith ls' would find '/bin/fills', but not '/bin/ls'.

-exactly
Do not use any regular expression matching when looking for the program.

-help
Shows you this help file.

-startswith
Indicates the the program name 'starts with' the name provided. Specifying '-startswith ls' would find '/bin/ls' and '/bin/lsmod', but not '/bin/filsize'.

PARAMETERS

str1 [str2 ... strN]
This is the string used to find programs in your PATH. You may specify more than one string (program name) to search for.

EXIT

If no fatal errors are detected, the program exits with a return code of 0.

AUTHOR

Written by Terry Gliedt <tpg@hps.com> 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