Bash syntax, square brackets and -d option

I have this command in bash:

[ -d node_modules/phantomjs ] || npm install -g phantomjs

I am not sure what it means in plain English…

Can anyone please advise?

Answer

It means :

If “node_modules/phantomjs” is not directory, run “npm install -g phantomjs”

See wikipedia true/false

Attribution
Source : Link , Question Author : balteo , Answer Author : Gilles Quenot

Leave a Comment