We currently have a command for setting the environment for only the following arguments/commands. The environment variables are set by a file, through a simple cat
command:
env $(cat "$1") <rest of the command>
However, shellcheck seems to mark this as "Quote this to prevent word splitting.shellcheck(SC2046)".
What would be the best way of handling this error, as I am not sure if I am correct by simply ignoring it for this particular case? As I am aware there are multiple routes to take (using xargs
, following principle of "useless cat", etc).
Example environment file:
VARIABLE_1=TEST
VARIABLE_2=TEST2
Update
I am hoping for some consensus among the community on how to write such .env
files and how to read those files. The file, nor the interpreter should do any more magic tricks than if we would this inline before a command.