1ENVPATH(1)            User Contributed Perl Documentation           ENVPATH(1)
2
3
4

NAME

6       envpath - Advanced operations on path variables
7

SYNOPSIS

9       Run this script with the "-help" option for usage details.
10

DESCRIPTION

12       Parses the command line, modifies the specified path variable(s), and
13       execs the remaining arguments. There are two modes, simple and
14       advanced:
15
16   SIMPLE MODE
17       Simple mode presents an alternative, platform-independent syntax for
18       specifying paths wherein the path separator is "," and environment
19       variables can be expanded with @NAME@. For example
20
21           envpath PATH=@PATH@,/usr/ucb -- printenv PATH
22
23       appends "/usr/ucb" to $PATH and execs printenv PATH. The "--" is
24       optional.
25
26       You can also specify prepending or appending by using "+=" or "=+"
27       respectively:
28
29           # place /usr/ucb at the front
30           envpath PATH+=/usr/ucb -- printenv PATH
31
32           # place /usr/ucb at the back
33           envpath PATH=+/usr/ucb -- printenv PATH
34
35       Simple mode requires only this script; it does not require Env::Path to
36       be installed.
37
38   ADVANCED MODE
39       Advanced mode basically provides command-line access to the features of
40       Env::Path (see), which must be installed. The "-E" flag selects the
41       path variable to operate on and other flags specify operations on it.
42       E.g.
43
44           envpath -E MANPATH -A /tmp -R /usr/share/man -N -U -- man ...
45
46       would take MANPATH, append /tmp to it, remove any references to
47       "/usr/share/man", remove any dirs which don't exist ("-N") and remove
48       redundant entries ("-U") before running man.
49
50       The -Whence option allows patterns. Thus
51
52           envpath -W "cat*"
53
54       would find all programs on PATH which match cat*.
55

CLEARCASE WINKINS

57       A big part of the motivation for this script was for use with ClearCase
58       builds; iff you know or care about ClearCase read on. Typically, during
59       builds (and not just with ClearCase), pathvars such as PATH, CLASSPATH,
60       and LD_LIBRARY_PATH must be strictly controlled.  One choice is to
61       force static values of these into the environment during the build
62       process, another is to simply require/expect users to set their paths
63       appropriately. Each of these can lead to subtle build or runtime
64       errors, however, and makes it hard for new users to get up to speed
65       since their personal environment must be just so.
66
67       Another common choice is to use only full pathnames within the
68       Makefile, avoiding reliance on search paths at all. This is often the
69       best way to go but can suppress ClearCase winkins.  For example, say
70       you're generating ascii files of some type with a binary executable you
71       just built:
72
73       $(INCDIR)/foo.h: $(BINDIR)/foomaker      $(BINDIR)/foomaker ...
74
75       The problem with this is that $(BINDIR) likely contains a platform part
76       such as 'solaris' or 'hpux', which makes it impossible to wink in the
77       foo.h file on other platforms even though it's ascii. This same thing
78       could come up even with a standard pre-built utility that's in
79       different places on different platforms; "yacc", for instance, is in
80       /usr/bin on Linux and /usr/ccs/bin on Solaris.
81
82       You could modify the path on the fly:
83
84       $(INCDIR)/foo.h: $(BINDIR)/foomaker      PATH=$(BINDIR)$(SEP)$$PATH
85       foomaker ...
86
87       but this suffers from the same problem: since $(BINDIR) and $PATH are
88       expanded literally within the build script they'll suppress winkins.
89       Here's a solution using envpath:
90
91       $(INCDIR)/foo.h: $(BINDIR)/foomaker      envpath PATH=@BINDIR@,@PATH@
92       foomaker ...
93
94       This hides the evaluation of BINDIR and PATH such that clearmake never
95       sees anything but the literals, thus clearing the field for winkins. Of
96       course envpath is capable of doing more than this, but it's the
97       original reason it was written.
98

AUTHOR

100       David Boyce <dsbperl AT boyski.com>
101
103       Copyright (c) 2000-2001 David Boyce. All rights reserved.  This Perl
104       program is free software; you may redistribute and/or modify it under
105       the same terms as Perl itself.
106

SEE ALSO

108       perl(1), "perldoc Env::Path"
109
110
111
112perl v5.32.1                      2021-01-27                        ENVPATH(1)
Impressum