diff options
Diffstat (limited to 'help/en/bash/which.html')
-rw-r--r-- | help/en/bash/which.html | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/help/en/bash/which.html b/help/en/bash/which.html new file mode 100644 index 0000000..2ea1a61 --- /dev/null +++ b/help/en/bash/which.html @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> +<head> +<link rel="STYLESHEET" href="../term_tools/main.css" type="text/css"> +<title>which MAN Page</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head><body><!-- #BeginLibraryItem "/Library/head_bash.lbi" --><div id="nav-menu"> +<ul> +<li><a class="rl" href="../term_tools/index.html"><img src="../term_tools/images/ss64.gif" title="Home" alt="Home"></a></li> +<li><a class="rl" href="../term_tools/bash"><img src="../term_tools/images/bash-l.gif" title="bash" alt="bash"></a></li> +<li><!-- Search Google --> +<form action="http://www.google.com/search" method="get" style="margin:0px;padding:0px;"> +<div align="right"> +<input name="q" type="text" class="body" size="25"> +<input class="submit" type="submit" value="Search"> +<input type="hidden" name="q" value="site:ss64.com/bash/"> +</div> +</form></li> +<li><a class="rr" href="syntax.html"><img src="../term_tools/images/syntax-r.gif" title="Bash Syntax"></a></li> +</ul> +</div> <!-- #EndLibraryItem --><h1> which</h1> +<p>Locate a program file in the user's path. </p> +<p>For each of its arguments which prints to stdout the full path + of the executable(s). It does this by searching the directories listed in the +environment variable PATH.</p> +<pre>Syntax + which [<em>options</em>] [--] <em>program_name</em> [...] + +Options + --all, -a + Print all matching executables in PATH, not just the + first. + + --read-alias, -i + Read aliases from stdin, reporting matching ones on + stdout. This is useful in combination with using an + alias for which itself. For example + alias which='alias | which -i'. + + --skip-alias + Ignore option --read-alias, if any. This is useful to + explicity search for normal binaries, while using the + --read-alias option in an alias for which. + + --skip-dot + Skip directories in PATH that start with a dot. + + --skip-tilde + Skip directories in PATH that start with a tilde and + executables which reside in the HOME directory. + + --show-dot + If a directory in PATH starts with a dot and a matching + executable was found for that path, then print + "./program_name" rather than the full path. + + --show-tilde + Output a tilde when a directory matches the HOME + directory. This option is ignored when which is + invoked as root. + + --tty-only + Stop processing options on the right if not on tty. + + --version, -v, -V + Print version information on standard output then exit + successfully. + + --help + Print usage information on standard output then exit + successfully. + +RETURN VALUE + Which returns the number of failed arguments, or -1 when + no programname was given. + +EXAMPLE + A useful way to use this utility is by adding an alias for + which like the following: + + alias which='which --tty-only --show-tilde --show-dot' + + This will print the readable ~/ and ./ when starting which + from your prompt, while still printing the full path when + used from a script: + + > which q2 + ~/bin/q2 + > echo `which q2` + /home/carlo/bin/q2 + + Aliases are also supported, through the use of an alias + for which itself. An example alias for which that is + using this feature is as follows: + + alias which='alias | which --tty-only --read-alias --show-tilde --show-dot' + + This will print the output of alias for each alias that + matches one of the given arguments. For example, using + this alias on itself in a tcsh: + + $ alias which alias \| /usr/bin/which -i !\* + $ which which + which (alias | ./which -i !*) + /usr/bin/which + +BUGS + The HOME directory is determined by looking for the HOME + environment variable, which aborts when this variable + doesn't exist. Which will consider two equivalent directories + to be different when one of them contains a path + with a symbolic link.</pre> +<p><i>"A man should never be ashamed to own he has been in the + wrong, which is saying in other words, that he is wiser today than he was yesterday" + - Alexander + Pope (thoughts on various subjects) </i><br> + <br> + <b> Related</b>:<br> + <br> + bash(1)<br> + <a href="pwd.html">pwd</a> - Print Working Directory <br> + <a href="hash.html">hash</a> - Remember the full pathname of a name argument + <br> + pathchk - Check file name portability <br> +<a href="whereis.html">whereis</a> - Search the user's $path, man pages and source files for a program<br> +Equivalent Windows commands: <a href="../term_tools/nt/where.html">WHERE</a> - Locate and display files in a directory +tree. </p> +<!-- #BeginLibraryItem "/Library/foot_bash.lbi" --><p align="left"><script type="text/javascript"><!-- +google_ad_client = "pub-6140977852749469"; +google_ad_width = 300; +google_ad_height = 250; +google_ad_format = "300x250_as"; +google_ad_type = "text_image"; +google_ad_channel ="1984328893"; +google_color_border = "CCCCCC"; +google_color_bg = "CCCCCC"; +google_color_link = "000000"; +google_color_text = "333333"; +google_color_url = "0000FF"; +//--></script> +<script type="text/javascript" + src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> +</script><br> +</p> +<div align="center"><hr size="1"> + <p id="top"><a href="#"><img src="../term_tools/images/top-4.gif" width="47" height="53" border="0" alt="Back to the Top" title="Back to the Top"></a></p> + <p class="tagline">© Copyright <a href="http://ss64.com/">SS64.com</a> 1999-2010<br> +Some rights reserved<br> +</p> +</div><!-- #EndLibraryItem --></body> +</html> |