Gentoo Archives: gentoo-dev

From: Peter Volkov <pva@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] /{"",usr/}bin path changed. What is the right solution for scripts?
Date: Sun, 01 Apr 2007 15:17:51
Message-Id: 1175440513.22663.40.camel@localhost
In Reply to: [gentoo-dev] /{"",usr/}bin path changed. What is the right solution for scripts? by Peter Volkov
1 On Sun, 2007-04-01 at 00:01 -0700, Alec Warner wrote:
2 > One idea that comes to mind is /usr/bin/env $bin
3
4 And here we return to the problem that one day /usr/bin/env, could
5 become /bin/env... Or that /usr/ sometimes is not mounted during boot.
6
7 Thus, well. Seems that have sane PATH in the beginning of script is the
8 best solution.
9
10 On Sun, 2007-04-01 at 03:09 -0400, Mike Frysinger wrote:
11 > On Sunday 01 April 2007, Alec Warner wrote:
12 > > For cron, one would need to set the PATH to something sane though.
13 >
14 > i thought sane cron systems would setup a sane PATH for you:
15 > /sbin:/usr/sbin:/bin:/usr/bin
16
17 At least fcron does not have default PATH compiled in. It inherits PATH
18 from environment. When we start fcron from init.d system it has some
19 default path set from /etc/init.d/function.sh (as Roy pointed).
20
21
22 Well. Thank you all for your answers. At least now I know that I have
23 not overlooked something trivial and seems that the best solution is to
24 set
25
26 PATH={PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
27
28 in the beginning of all shell scripts and to avoid usage of full path to
29 executable.
30
31 --
32 Peter.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] /{"",usr/}bin path changed. What is the right solution for scripts? Ciaran McCreesh <ciaranm@×××××××.org>