Can a conditional statement be inserted in, for example, a print command like echo with bash?
E.g. (does not work)
$ cat t.sh
#!/bin/bash
string1="It's a "
string2opt1="beautiful"
string2opt2="gross"
string3=" day."
read c
echo -n "$string1 $( [[ $c -eq 0 ]] && { echo -n "$string2opt1" } || { echo "$string2opt2" } ) $string3"
I know that this is possible with semicolons/non-one-liners; I am just wondering if there is a more elegant or accepted way of doing this.