source: trunk/essentials/app-shells/bash/examples/scripts.v2/where@ 3506

Last change on this file since 3506 was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 2.6 KB
Line 
1#! /bin/bash
2#
3# original from:
4# @(#) where.ksh 1.1 94/07/11
5# 91/01/12 john h. dubois iii ([email protected])
6# 92/08/10 Only print executable *files*.
7# 92/10/06 Print err msg if no match found.
8# 92/11/27 Added implicit *
9# 93/07/23 Print help only if -h is given.
10# 94/01/01 Added -x option
11# 94/07/11 Don't bother with eval
12#
13# conversion to bash v2 syntax done by Chet Ramey
14
15name=${0##*/}
16Usage="Usage: $name [-hx] 'pattern' ..."
17typeset -i exact=0
18
19phelp()
20{
21echo "$name: find executable files in PATH that match patterns.
22$Usage
23$name searches each directory specified in the PATH environment variable
24for executable files that match the specified patterns. Patterns are
25given as Korn shell filename patterns. They are surrounded by implicit
26'*' characters, so that \"foo\" will match any executble file whose name
27contains contains \"foo\". This can be overridden by using '^' and '$' to
28force a match to start at the beginning and end at the end of a filename
29respectively. Characters that are special to the shell must generally
30be protected from the shell by surrounding them with quotes.
31Examples:
32$name foo
33lists all executable files in PATH that contain foo.
34$name '^b*sh$'
35lists all executable files in PATH that start with b and end with sh.