I'm told to run this command on terminal:
sudo env PATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 unstartup launchd -u dora --hp /Users/dora
It seems like it's multiple commands in one line:
sudo env PATH=$PATH:/usr/local/bin
/usr/local/lib/node_modules/pm2/bin/pm2 unstartup launchd -u dora --hp /Users/dora
But, how does that work? I know A;B, A&&B, A||B, but this looks like A B.
Best Answer
It indeed are multiple commands which get run here. If you look up
man env
you'll findwhich explains that
env
does, among other things,[name=value ...]
bit which in your case isPATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2
)[utility [argument ...]]
bit, in your case the call tonpm
).The intention here is to extend the search PATH of the command run through
sudo
in order to havenpm
find all the executables it needs.This is purely a feature of
env
, other commands likesudo
orxargs
have similar capabilities. OTOHA;B
,A && B
orA || B
are shell features.