Comment

Comment by yebyen

   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.

parent yebyen 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton