>/var/lib/docker is a directory OR we print an error

naah, this must be wrong...

@Wolf480pl rewriting your own crappy scripts is always fun

ok, at this point I don't know what level of sarcasm are we on, so let me ask you a honest question:

that the deleted line was correct and the new one is wrong, right?

@Wolf480pl no, the new line is correct. The problem is, I wasn't drunk when I wrote the previous variant.

@tdemin whaat?

ok, let's assume Docker is installed.

/var/lib/docker exists.

With the old line (marked in red):

[[ -d /var/lib/docker ]] is true (exits with zero)

[[ -d /var/lib/docker ]] || die

is true because the left hand side is true, so the right hand side ("die") is never evaluated

the script continues without error

With new line (blue):

[[ ! -d /var/lib/docker ]] is false (exits with one)

[[ ! -d /var/lib/docker ]] || die

needs to evaluate the right hand side, and dies.

@Wolf480pl oh my god. This || was literally interpreted as && in my mind, and I now have to revert the change "fixing" this.

Many thanks.

@tdemin well it's unintuitive as fuck if you're not used to it....

Sign in to participate in the conversation

Mastodon日本鯖です. 10/22(火) 10:07頃より高いアクセス負荷が観測されており、サービスの運営に支障が出る状況のため、一部のアクセスを制限しておりましたが、制限を解除いたしました。(11/18更新)