The variables need a dollar sign: $VARIABLE1
help test
shows what -n
and -z
do.
The variables need a dollar sign: $VARIABLE1
help test
shows what -n
and -z
do.
Never use a && b || c
. It is not the same as if a; then b; else c; fi
: when a
succeeds but b
fails, it will run both b
and c
.
I would not bother with [
unless you absolutely need compatibility with non-bash shells.
Try opening a terminal an typing echo 'Hello World!'
My two cents: You can forget about Linux for a while. Using a terminal is more important.
Here’s a classic guide: https://mywiki.wooledge.org/BashGuide
Cool operating system bro. Does it run KDE?
in
[[
, empty strings are falsy, so this also works:[[ ! $VARIABLE1 && ! $VARIABLE2 ]] && echo "OK"