…with an open minded approach

Posts tagged “terminal

bash ternary-like comparisons…

Bash does not have a ternary operator ?: to do things like ” condition ? command-if-true : command-if-false ”

Its possible to do the same with “if”s but its not so neat and compact…

One hacky alternative which is possible in bash, is to do ” condition && command-if-true || command-if-false”, like so:

Hope it helps – if so drop a comment