News for hackers. Stuff that matters.
Re:Ask HN: Anyone moved to PC-BSD (TrueOS) from macOS? by yebyen on Wednesday March 08, 2017 @02:49PM (#13823128)

   xinit & && exit
I don't mean to ask a silly question, but what exactly is this meant to do? (What might it do that plain old `xinit & exit` doesn't do?)

&& is a binary op meant to execute the following command if the return code of the preceding command is success (0)

& is another shell builtin that sends the command preceding it to the background, and lets the shell continue with whatever comes next...

So, at first I read your edit and thought "Oh, this will exit the shell unless X can't be started" ... but exit should be running before X ever gets around to returning, no?

I just read the man page for my favorite shell, and it says the return code for `&` is always 0. So it's clear that `& &&` will work, but I don't see anything suggesting it will do anything that `&` alone won't do.

Just want to know if you know something I don't, and I figure there's no better place to learn a new shell thing than on a HN thread about BSD OS.

Re:Ask HN: Anyone moved to PC-BSD (TrueOS) from macOS? by dromenkoning on Thursday March 09, 2017 @12:39PM (#13831026)
Nothing special going on here; my syntax is based on me not knowing the particulars of `&`. I'll try to remember using yours in the future as it's more elegant. Thanks for the reply.