I am trying to use systemd's EnvironmentFile and add an option to the command when it is set in the file. I have the following in the unit file:
ExecStart=/usr/bin/bash -c "echo ${PORT:+port is $PORT}" which doesn't echo anything when I start the service.
The following works as expected:
ExecStart=/usr/bin/bash -c "echo port is $PORT" which means that the file is read correctly.
Parameter substitution also works on command line:
$ PORT=1234 bash -c 'echo ${PORT:+port is $PORT}' port is 1234 What am I missing?