I'm trying to set an environment variable and execute a command in a single line, like this:
export PUB_CACHE=/app/src/.pub-cache && dart-sdk/bin/dart server.dart
(Don't ask why... it's complicated ;))
It's being invoked by someone elses script; and it fails like this:
export: `&&': not a valid identifier6:44 PM
export: `dart-sdk/bin/dart': not a valid identifier6:44 PM
export: `server.dart': not a valid identifier
It seems like the entire rest of the line is being passed to export. It's entirely possible it's due to the way they're running the command and I can't fix it, but it's also possibly just my Linux noobishness.
Is there something wrong with my command? Can I easily make it execute both things individually?
&&
.dash
or any other shell? What doesecho $0
print? What if you remove the&&
or replace it by;
?env
, notexport
--env VAR=thing someCommand
, or with bash, justVAR=thing someCommand