7 substenv - Substitute environment variables in parameters and run the resulting command
11 substenv I<COMMAND> [I<ARGS>]
15 Replace all occurrances of C<$NAME> in I<COMMAND> and I<ARGS> to the I<NAME> environment
16 variable's value, then run I<COMMAND>.
20 This function call, in C, runs substenv(1),
21 note, there is no dollar-interpolation in C.
23 execve("substenv", ["substenv", "ls", "$HOME/.config"])
25 Then substenv issues this system call:
27 execve("ls", ["ls", "/home/jdoe/.config"])
31 Does not support full shell-like variable interpolation.
32 Use a real shell for it.
36 Sometimes you don't want a shell to be in the picture when composing commands,
37 yet need to weave some environment variable into it.
41 envsubst(1) from gettext-base package
50 $arg =~ s/\$([A-Z0-9_]+)/$ENV{$1}/g;
54 exec {$run_cmd[0]} @run_cmd;
55 ($errno, $errstr) = (int $!, $!);
56 warn "$0: ${run_cmd[0]}: $errstr\n";