I'm trying to understand the first part of the second line -- `which osascript > /dev/null 2>&1 &&` \-- in the following script, from this [Tips And Tricks](https://emacsformacosx.com/tips) page, to start emacsclient on MacOS:
#!/bin/sh
which osascript > /dev/null 2>&1 && osascript -e 'tell application "Emacs" to activate'
emacsclient -c "$@"
.My (very meagre) understanding is that the script does the following three things:
1. Check that osascript is present
2. Launch Emacs (which I guess it is assumed should have a call to `(server-start)` in its init.el or .emacs), *but only if* osascript is present,
3. Run emacsclient
Is that right? If so, I have two questions:
1. **Exactly how does the "*****but only if*****" in my point #2 above work?** I assume that if the `which osascript` fails, then the call to `osascript -e` never happens. But how is that done? Something to do with the `&&` I presume?
2. **Why is the script author making only the call to** `oasscript -e` **conditional on a successful** `which osascript`? Why don't they also gate the `emacsclient` **line itself?** (In other words why don't just they kill the whole script if the `which` fails?) I might have understood letting the `emacsclient` line still run, even if the `which` had failed, but only if the author had included a `-a` option for `emacsclient`. Then, even if the failed `which` did blocked the call to `oascript -e` which in turn meant there would be no Emacs launched (and so no call to `start-server`), still `emacsclient` could have launched the alternate editor it had been given using `-a`. But as it stands, it looks like `emacsclient` will still valiantly attempt to launch even though it is almost certainly doomed to failure through lack of an emacs server.
???