env command
KSXGitHub opened this issue · 3 comments
KSXGitHub commented
I wish to convert this verbose command:
cross-env FOO=foo BAR=bar shx command
to this:
shx env FOO=foo BAR=bar command
nfischer commented
Can you give a concrete example? Most shelljs commands do not examine environmental variables, and it's not clear which case you're actually hitting.
KSXGitHub commented
@nfischer I think you misunderstand.
Most shelljs commands do not examine environmental variables
I don't need shelljs commands to read environment variables, I need a shelljs command that sets an environment variable and spawns a subprocess with that new environment variable (similar to UNIX's env
command).
For example:
shx env FOO=foo BAR=bar node -p 'console.log(process.env.FOO, process.env.BAR)'
should print foo bar
.
Also, UNIX's env
without any arguments would print all environment variables (so yeah, it does read).