source: general/sysutils/which.xml@ 2687739

10.0 10.1 11.0 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk v5_1 v5_1-pre1 xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 2687739 was 2687739, checked in by Tushar Teredesai <tushar@…>, 17 years ago

Improved which script

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@2150 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 1.2 KB
Line 
1<sect1 id="which" xreflabel="which-&which-version;">
2<?dbhtml filename="which.html"?>
3<title>which-&which-version; and alternatives</title>
4
5<para>The presence / absence of the which program in the main <acronym>LFS
6</acronym> book is probably one of the most contentious issues we have on the
7mailing lists. It has resulted in at least one flame war in the recent past.
8To hopefully put an end to this once and for all, we here present two of
9the options for equipping your system with "which". The question of which "which"
10is for you to decide.</para>
11
12<para>The first option is to install the actual <acronym>GNU</acronym> program
13<emphasis>which</emphasis>.</para>
14
15&which-intro;
16&which-inst;
17&which-desc;
18
19<sect2><title>The 'which' script</title>
20<para>The second option (for those who don't want to install the program)
21is to create a simple script:</para>
22<screen><userinput><command>cat &gt; /usr/bin/which &lt;&lt; "EOF"</command>
23#!/bin/bash
24type -pa "$@" | head -n 1 ; exit ${PIPESTATUS[0]}
25<command>EOF
26chmod 755 /usr/bin/which
27chown root:root /usr/bin/which</command></userinput></screen>
28<para>This should generally work OK and is probably the easiest solution
29for boxes which don't need a good user environment to work in.</para>
30</sect2>
31
32</sect1>
33
Note: See TracBrowser for help on using the repository browser.