Am 06.09.24 um 11:04 schrieb Andrei Borzenkov:
You need to quote $ to pass it to the shell.
ExecStart = sh -c 'echo Res: $${VAR#abc-}'
Yes, this works. However, I didn't find this anywhere in the systemd man
pages. What I found was escaping using a backslash, but that didn't work.
On Fri, Sep 6, 2024 at 1:40 PM Thomas Köller wrote:
>
> Am 06.09.24 um 11:04 schrieb Andrei Borzenkov:
> > You need to quote $ to pass it to the shell.
> > ExecStart = sh -c 'echo Res: $${VAR#abc-}'
>
> Yes, this works. However, I didn't find this anywhere in the systemd man
> pages. What I found
Am Freitag, dem 06.09.2024 um 10:18 +0200 schrieb Thomas Köller:
> I am having problems expanding environment variables in a service file.
> This test serivice illustrates the problem:
>
> `root@yoga:/etc/systemd/system# cat varexp.service`
>
> ```ini
> [Unit]
> Description = Test environment
On Fri, Sep 6, 2024 at 11:24 AM Thomas Köller wrote:
>
> I am having problems expanding environment variables in a service file.
> This test serivice illustrates the problem:
>
> root@yoga:/etc/systemd/system# cat varexp.service
> [Unit]
> Description = Test environment variable expansion
>
> [Ser
I am having problems expanding environment variables in a service file.
This test serivice illustrates the problem:
root@yoga:/etc/systemd/system# cat varexp.service
[Unit]
Description = Test environment variable expansion
[Service]
Type = oneshot
Environment = "VAR=abc-xyz"
ExecStart = sh -c '