Re: Proposal: let execline's envfile do substitution

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Fri, 20 Sep 2024 12:37:21 +0000

>I wanted to ask whether variable substitution could be added to the envfile program of execline.

  No.


>example.conf
>
>| ${A}=/home/${USER}/somewhere
>
>
>examplescript
>
>| #!/bin/execlineb
>|
>| define A x
>| define USER y
>|
>| envfile example.conf
>|
>| printenv
>
>should print x=/home/y/somewhere

  You can instantiate a configuration file before feeding it to envfile:

example.conf:

_at_location_at_=/home/_at_user_at_/somewhere


examplescript:

#!/bin/execlineb -S0
pipeline { redirfd -r 0 example.conf sed -e "s/_at_location_at_/x/g;
s/_at_user_at_/y/g;" }
envfile -
printenv

  Unix tools are powerful. Use them. ;)

--
  Laurent
Received on Fri Sep 20 2024 - 14:37:21 CEST

This archive was generated by hypermail 2.4.0 : Fri Sep 20 2024 - 14:44:09 CEST