"Fossies" - the Fresh Open Source Software Archive 
Member "which-2.21/README" (20 Mar 2015, 4433 Bytes) of package /linux/privat/which-2.21.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "README":
2.20_vs_2.21.
1 Install
2 =======
3
4 You will need an ANSI C compiler (like gcc) to compile this package.
5
6 Just type `make', followed by `make install'.
7
8 History
9 =======
10
11 The main difference with version 1.0 by Paul Vixie is that this
12 version will not return directory names as being executables
13 and that by default it will expand a leading "./" and "~/" to
14 its full path on output.
15
16 The -all option has been added in example of a version of which
17 on Ultrix. They use `-a' as option.
18
19 The --read-alias idea has been copied from a version of which by
20 Maarten Litmaath called `which-v6', he was using `-i' as option
21 which stands for `interactive'.
22
23 Manual page
24 ===========
25
26
27 NAME
28 which - shows the full path of (shell) commands.
29
30 SYNOPSIS
31 which [options] [--] programname [...]
32
33 DESCRIPTION
34 Which takes one or more arguments. For each of its arguments it prints
35 to stdout the full path of the executables that would have been exe-
36 cuted when this argument had been entered at the shell prompt. It does
37 this by searching for an executable or script in the directories listed
38 in the environment variable PATH using the same algorithm as bash(1).
39
40 This man page is generated from the file which.texinfo.
41
42 OPTIONS
43 --all, -a
44 Print all matching executables in PATH, not just the first.
45
46 --read-alias, -i
47 Read aliases from stdin, reporting matching ones on stdout. This is
48 useful in combination with using an alias for which itself. For
49 example
50 alias which='alias | which -i'.
51
52 --skip-alias
53 Ignore option `--read-alias', if any. This is useful to explicity
54 search for normal binaries, while using the `--read-alias' option
55 in an alias or function for which.
56
57 --read-functions
58 Read shell function definitions from stdin, reporting matching ones
59 on stdout. This is useful in combination with using a shell func-
60 tion for which itself. For example:
61 which() { declare -f | which --read-functions $@ }
62 export -f which
63
64 --skip-functions
65 Ignore option `--read-functions', if any. This is useful to explic-
66 ity search for normal binaries, while using the `--read-functions'
67 option in an alias or function for which.
68
69 --skip-dot
70 Skip directories in PATH that start with a dot.
71
72 --skip-tilde
73 Skip directories in PATH that start with a tilde and executables
74 which reside in the HOME directory.
75
76 --show-dot
77 If a directory in PATH starts with a dot and a matching executable
78 was found for that path, then print "./programname" rather than the
79 full path.
80
81 --show-tilde
82 Output a tilde when a directory matches the HOME directory. This
83 option is ignored when which is invoked as root.
84 --version,-v,-V
85 Print version information on standard output then exit success-
86 fully.
87
88 --help
89 Print usage information on standard output then exit successfully.
90
91 RETURN VALUE
92 Which returns the number of failed arguments, or -1 when no `program-
93 name' was given.
94
95 EXAMPLE
96 The recommended way to use this utility is by adding an alias (C shell)
97 or shell function (Bourne shell) for which like the following:
98
99 [ba]sh:
100
101 which ()
102 {
103 (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
104 }
105 export -f which
106
107 [t]csh:
108
109 alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
110
111 This will print the readable ~/ and ./ when starting which from your
112 prompt, while still printing the full path when used from a script:
113
114 > which q2
115 ~/bin/q2
116 > echo `which q2`
117 /home/carlo/bin/q2
118
119
120 BUGS
121 The HOME directory is determined by looking for the HOME environment
122 variable, which aborts when this variable doesn't exist. Which will
123 consider two equivalent directories to be different when one of them
124 contains a path with a symbolic link.
125
126 AUTHOR
127 Carlo Wood <carlo@gnu.org>
128
129 SEE ALSO
130 bash(1)
131
132
133
134 WHICH(1)