I have a script which installs a tool, if it's not already on my system:
#!/bin/bash
ASCIIDOCTOR_BIN=`command -v asciidoctor`
if ! [ -x $ASCIIDOCTOR_BIN ]; then ......
The problem is, that it doesn't seem to be working: the conditional expression always evaluates to false
.
Even with
#!/bin/bash
ASCIIDOCTOR_BIN=`command -v asciidoctor`
if ! [ false ]; then ......
the condition turns out to be just false.
As I was playing around with it I found out that if I replace the brackets with double brackets, it works:
#!/bin/bash
ASCIIDOCTOR_BIN=`command -v asciidoctor`
if ! [[ -x $ASCIIDOCTOR_BIN ]]; then ......
Can any1 explain why is that? I was told to avoid double brackets and curious, if there are other ways to make this script work.
I am working on Ubuntu 20.04.