logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

runenv.8 (5261B)


  1. .\" runenv.8
  2. .\" wcm, 2009.09.17 - 2009.12.15
  3. .\" ===
  4. .TH runenv 8 "January 2013" "runtools-2.07" "runtools"
  5. .SH NAME
  6. runenv \- run a program with a modified environment
  7. .SH SYNOPSIS
  8. .B runenv [\-hV] [\-i] [\-U
  9. .I acct
  10. .B ]
  11. .I newenv
  12. .I program
  13. .B [
  14. .I args ...
  15. .B ]
  16. .SH DESCRIPTION
  17. .B runenv
  18. starts
  19. .I program
  20. with a modified environment.
  21. As distinct from common versions of
  22. .BR env (1),
  23. modifications are applied only within the environment of
  24. .IR program;
  25. the environment of
  26. .B runenv
  27. itself is not affected.
  28. .PP
  29. Modifications for the new environment are specified in the argument
  30. .IR newenv ,
  31. which is either a file or a directory.
  32. If
  33. .I newenv
  34. is a
  35. .B \-
  36. (single dash),
  37. .B runenv
  38. reads the modifications from standard input as described for a file.
  39. .PP
  40. The argument
  41. .I program
  42. may be either a pathname or a filename.
  43. If
  44. .I program
  45. contains a ``/'' (slash) character,
  46. it is considered a pathname and
  47. .B runenv
  48. will attempt to invoke it directly.
  49. Otherwise,
  50. .B runenv
  51. will perform a shell-like search for
  52. .I program
  53. within the directories defined in the PATH
  54. variable of the runtime environment of
  55. .BR runenv .
  56. .PP
  57. If the argument
  58. .I newenv
  59. is a file:
  60. .PP
  61. The file
  62. .I newenv
  63. is opened and read line by line.
  64. A line in the form of
  65. .I k=v
  66. is interpreted as an environmental variable,
  67. .IR k ,
  68. defined with a value of
  69. .IR v .
  70. If the variable
  71. .I k
  72. does not exist in the current environment,
  73. .I k=v
  74. will be added to the environment of
  75. .IR program .
  76. If the variable
  77. .I k
  78. does exist in the current environment,
  79. its value will be replaced by
  80. .I v
  81. in the environment of
  82. .IR program .
  83. .PP
  84. A line in the form of
  85. .I k
  86. only, without
  87. .IR =v ,
  88. specifies that any existing variable
  89. .I k
  90. will be deleted (unset) from the environment of
  91. .IR program .
  92. .PP
  93. All names and values read from
  94. .I file
  95. are trimmed of leading and trailing whitespace.
  96. Empty lines and lines beginning with ``#'' are ignored.
  97. .PP
  98. If the argument
  99. .I newenv
  100. is a directory:
  101. .PP
  102. Each file
  103. .I k
  104. in the directory
  105. .I newenv
  106. is interpreted as an environmental variable
  107. .IR k=v ,
  108. where
  109. .I k
  110. is the name of the file,
  111. and
  112. .I v
  113. is read from the first line of the file.
  114. As above, if the variable
  115. .I k
  116. does not exist in the current environment,
  117. .I k=v
  118. will be added to the environment of
  119. .IR program .
  120. If the variable
  121. .I k
  122. does exist in the current environment,
  123. its value will be replaced by
  124. .I v
  125. in the environment of
  126. .IR program .
  127. .PP
  128. If the file
  129. .I k
  130. is empty,
  131. then any existing variable
  132. .I k
  133. will be deleted (unset) from the environment of
  134. .IR program .
  135. .PP
  136. Filenames in the directory
  137. .I newenv
  138. that begin with ``.'' are ignored,
  139. and filenames should not contain ``=''.
  140. The values read from files in
  141. .I newenv
  142. are trimmed of leading and trailing whitespace.
  143. No special provision is made for commenting files,
  144. except to note that any text occuring after the first line is ignored.
  145. .PP
  146. Escape sequences:
  147. .PP
  148. Whether
  149. .I newenv
  150. is a file or directory,
  151. a limited number of two-character escape sequences are supported within
  152. value definitions:
  153. .TP
  154. ``\\n''
  155. is changed to newline
  156. .TP
  157. ``\\t''
  158. is changed to tab
  159. .TP
  160. ``\\_'' (backslash + underscore) is changed to single space
  161. .TP
  162. ``\\\\''
  163. is changed to single backslash
  164. .PP
  165. These escape sequences make it possible to embed newlines in values,
  166. and provide a way to retain leading and trailing whitespace.
  167. Any other ``\\'' sequences found within a value are left verbatim.
  168. .SH OPTIONS
  169. .TP
  170. .B \-h
  171. Help.
  172. Display brief usage message and exit.
  173. .TP
  174. .B \-i
  175. Ignore existing environment.
  176. Normally
  177. .B runenv
  178. modifies the existing environment.
  179. If the
  180. .B \-i
  181. option is specified,
  182. any existing environment is ignored and only new environment definitions
  183. are passed to
  184. .IR program .
  185. .TP
  186. .B \-U acct
  187. UID/GID.
  188. A few programs look specifically for environmental variables named
  189. .I UID
  190. and
  191. .IR GID .
  192. The
  193. .B \-U
  194. option may be used as a convenient way to set these variables with the uid/gid
  195. corresponding to the user name
  196. .IR acct .
  197. Note that this option emphatically does nothing by itself
  198. to change the executable permissions of
  199. .IR program .
  200. It only sets up a couple of environmental variables
  201. that
  202. may (or may not) be used by the subsequent
  203. .IR program
  204. according to its own design.
  205. To affect the actual set-user-ID permissions of
  206. .IR program ,
  207. see
  208. .BR runuid (8).
  209. .TP
  210. .B \-V
  211. Version.
  212. Report the version number and exit.
  213. .SH EXIT STATUS
  214. .B runenv
  215. exits with one of the following values:
  216. .TP
  217. 0
  218. .I program
  219. was invoked and completed successfully.
  220. In this case,
  221. the exit code is returned by the
  222. .IR program ,
  223. rather than by
  224. .B runenv
  225. itself.
  226. .TP
  227. 100
  228. .B runenv
  229. failed because of a usage error,
  230. such as an invalid command\-line option or argument.
  231. In this case,
  232. .B runenv
  233. prints a brief error message and usage help to stderr on exit.
  234. .TP
  235. 111
  236. .B runenv
  237. failed due to some system or resource error.
  238. In this case,
  239. .B runenv
  240. prints a brief diagnostic message to stderr on exit.
  241. .TP
  242. 1\-127
  243. .I program
  244. was invoked and failed with its own non-zero exit status.
  245. .SH AUTHOR
  246. Wayne Marshall, http://b0llix.net/perp/
  247. .SH SEE ALSO
  248. .nh
  249. .BR runtools_intro (8),
  250. .BR runargs (8),
  251. .BR runargv0 (8),
  252. .BR runchoom (8),
  253. .BR rundetach (8),
  254. .BR rundeux (8),
  255. .BR runfile (8),
  256. .BR runlimit (8),
  257. .BR runlock (8),
  258. .BR runpause (8),
  259. .BR runsession (8),
  260. .BR runtool (8),
  261. .BR runtrap (8),
  262. .BR runuid (8)
  263. ..\" EOF: runenv.8