[52d29f7] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[52d29f7] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY which-download-http "http://www.xs4all.nl/~carlo17/which/which-&which-version;.tar.gz">
|
---|
| 8 | <!ENTITY which-download-ftp "ftp://ftp.gnu.org/gnu/which/which-&which-version;.tar.gz">
|
---|
[a31d341d] | 9 | <!ENTITY which-md5sum "830b83af48347a9a3520f561e47cbc9b">
|
---|
[52d29f7] | 10 | <!ENTITY which-size "123 KB">
|
---|
| 11 | <!ENTITY which-buildsize "940 KB">
|
---|
| 12 | <!ENTITY which-time "0.03 SBU">
|
---|
| 13 | ]>
|
---|
| 14 |
|
---|
[f45b1953] | 15 | <sect1 id="which" xreflabel="which-&which-version;">
|
---|
[a0f03b0] | 16 | <sect1info>
|
---|
[5cd0959d] | 17 | <othername>$LastChangedBy$</othername>
|
---|
| 18 | <date>$Date$</date>
|
---|
[a0f03b0] | 19 | </sect1info>
|
---|
[7f72cbf] | 20 | <?dbhtml filename="which.html"?>
|
---|
[1586494] | 21 | <title><application>which</application>-&which-version; and alternatives</title>
|
---|
[3891001] | 22 | <indexterm zone="which">
|
---|
| 23 | <primary sortas="a-Which">Which</primary></indexterm>
|
---|
[f45b1953] | 24 |
|
---|
[3891001] | 25 | <para>The presence or absence of the <command>which</command> program in the
|
---|
| 26 | main <acronym>LFS</acronym> book is probably one of the most contentious
|
---|
| 27 | issues on the mailing lists. It has resulted in at least one flame war in the
|
---|
| 28 | past. To hopefully put an end to this once and for all, presented here are two
|
---|
| 29 | options for equipping your system with <command>which</command>. The question
|
---|
| 30 | of which <quote><command>which</command></quote> is for you to decide.</para>
|
---|
[f45b1953] | 31 |
|
---|
[46bca118] | 32 | <para>The first option is to install the actual <acronym>GNU</acronym> program
|
---|
[85ef7049] | 33 | <emphasis>which</emphasis>.</para>
|
---|
| 34 |
|
---|
[52d29f7] | 35 | <sect2>
|
---|
| 36 | <title>Introduction to <application>which</application></title>
|
---|
[1586494] | 37 |
|
---|
[52d29f7] | 38 | <sect3><title>Package information</title>
|
---|
| 39 | <itemizedlist spacing='compact'>
|
---|
| 40 | <listitem><para>Download (HTTP): <ulink
|
---|
| 41 | url="&which-download-http;"/></para></listitem>
|
---|
| 42 | <listitem><para>Download (FTP): <ulink
|
---|
| 43 | url="&which-download-ftp;"/></para></listitem>
|
---|
[a31d341d] | 44 | <listitem><para>Download MD5 sum: &which-md5sum;</para></listitem>
|
---|
[52d29f7] | 45 | <listitem><para>Download size: &which-size;</para></listitem>
|
---|
[1586494] | 46 | <listitem><para>Estimated disk space required:
|
---|
[52d29f7] | 47 | &which-buildsize;</para></listitem>
|
---|
| 48 | <listitem><para>Estimated build time:
|
---|
| 49 | &which-time;</para></listitem></itemizedlist>
|
---|
| 50 | </sect3>
|
---|
[1586494] | 51 |
|
---|
[52d29f7] | 52 | </sect2>
|
---|
| 53 |
|
---|
| 54 | <sect2>
|
---|
| 55 | <title>Installation of <application>which</application></title>
|
---|
[1586494] | 56 |
|
---|
[52d29f7] | 57 | <para>Install <application>which</application> by running the following
|
---|
| 58 | commands:</para>
|
---|
[1586494] | 59 |
|
---|
[52d29f7] | 60 | <screen><userinput><command>./configure --prefix=/usr &&
|
---|
[3891001] | 61 | make</command></userinput></screen>
|
---|
[52d29f7] | 62 |
|
---|
[3891001] | 63 | <para>Now, as the root user:</para>
|
---|
[52d29f7] | 64 |
|
---|
[3891001] | 65 | <screen><userinput role='root'><command>make install</command></userinput></screen>
|
---|
[1586494] | 66 |
|
---|
[52d29f7] | 67 | </sect2>
|
---|
[1586494] | 68 |
|
---|
[3891001] | 69 | <sect2>
|
---|
| 70 | <title>Contents</title>
|
---|
[1586494] | 71 |
|
---|
[3891001] | 72 | <segmentedlist>
|
---|
| 73 | <segtitle>Installed Program</segtitle>
|
---|
| 74 | <segtitle>Installed Libraries</segtitle>
|
---|
| 75 | <segtitle>Installed Directories</segtitle>
|
---|
| 76 |
|
---|
| 77 | <seglistitem>
|
---|
| 78 | <seg>which</seg>
|
---|
| 79 | <seg>None</seg>
|
---|
| 80 | <seg>None</seg>
|
---|
| 81 | </seglistitem>
|
---|
| 82 | </segmentedlist>
|
---|
| 83 |
|
---|
| 84 | <variablelist>
|
---|
| 85 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 86 | <?dbfo list-presentation="list"?>
|
---|
| 87 |
|
---|
| 88 | <varlistentry id="which-prog">
|
---|
| 89 | <term><command>which</command></term>
|
---|
| 90 | <listitem><para>shows the full path of (shell) commands installed in your
|
---|
| 91 | <envar>PATH</envar>.</para>
|
---|
| 92 | <indexterm zone="which which-prog">
|
---|
| 93 | <primary sortas="b-which">which</primary>
|
---|
| 94 | </indexterm></listitem>
|
---|
| 95 | </varlistentry>
|
---|
| 96 | </variablelist>
|
---|
[1586494] | 97 |
|
---|
[52d29f7] | 98 | </sect2>
|
---|
[f45b1953] | 99 |
|
---|
[52d29f7] | 100 | <sect2>
|
---|
| 101 | <title>The 'which' script</title>
|
---|
[85ef7049] | 102 | <para>The second option (for those who don't want to install the program)
|
---|
[3891001] | 103 | is to create a simple script (execute as the root user):</para>
|
---|
| 104 |
|
---|
| 105 | <screen><userinput role='root'><command>cat > /usr/bin/which << "EOF"</command>
|
---|
[f45b1953] | 106 | #!/bin/bash
|
---|
[2687739] | 107 | type -pa "$@" | head -n 1 ; exit ${PIPESTATUS[0]}
|
---|
[110ec35a] | 108 | <command>EOF
|
---|
[f45b1953] | 109 | chmod 755 /usr/bin/which
|
---|
[110ec35a] | 110 | chown root:root /usr/bin/which</command></userinput></screen>
|
---|
[3891001] | 111 |
|
---|
[70b65ddf] | 112 | <para>This should work OK and is probably the easiest solution
|
---|
| 113 | for most cases, but is not the most comprehensive implementation.</para>
|
---|
[85ef7049] | 114 | </sect2>
|
---|
[f45b1953] | 115 |
|
---|
| 116 | </sect1>
|
---|
| 117 |
|
---|