glfs/general/sysutils/which.xml

33 lines
1.1 KiB
XML
Raw Normal View History

<sect1 id="which" xreflabel="which-&which-version;">
<?dbhtml filename="which.html" dir="general"?>
<title>which-&which-version; and alternatives</title>
<para>The presence / absence of the which program in the main LFS book
is probably one of the most contentious issues we have on the mailing
lists. It has resulted in at least one flame war in the recent past.
To hopefully put an end to this once and for all, we here present two of
the options for equipping your system with "which".</para>
<para>The first option is to install the actual GNU program
<emphasis>which</emphasis>.</para>
&which-intro;
&which-inst;
&which-desc;
<sect2><title>The 'which' script</title>
<para>The second option (for those who don't want to install the program)
is to create a simple script:</para>
<para><screen><userinput>cat &gt; /usr/bin/which &lt;&lt; "EOF"</userinput>
#!/bin/bash
type -p "$@"
<userinput>EOF
chmod 755 /usr/bin/which
chown root:root /usr/bin/which</userinput></screen></para>
<para>This should generally work OK and is probably the easiest solution
for boxes which don't need a good user environment to work in.</para>
</sect2>
</sect1>