Re: .env file handling

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Tue, 24 Oct 2017 06:22:46 +0000

>I tried rewriting the whole thing in execline and while I'm pretty sure
>it's doable it's not easy.

  A direct translation of Casper's script to execline could be:

#!/command/execlineb -P
backtick LIST { cat /path/to/xyz.env }
importas -nsd"\n" LIST LIST
env -i ${LIST}
/path/to/xyz

  It's not as idiomatic as other ways to handle variables in execline,
but it should work.

  The underlying difficulty with Monty's question is that execline tries
to avoid parsing as much as possible, and a file full of key=value
lines,
as simple as it is, still requires some parsing. execline wasn't made
for this; the idiomatic way to store key-value pairs in the filesystem
for use by an execline script is, as Monty found out, s6-envdir.
If you really want a shell-like syntax, the best way to handle it is
with tools that already understand this syntax, such as a shell, or as
Casper suggested, env.

--
  Laurent
Received on Tue Oct 24 2017 - 06:22:46 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC