Can a conditional statement be inserted in, for example, a print command like echo with bash?
E.g. (does not work)
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.
https://stackoverflow.com/questions/65572275/can-a-conditional-statement-be-used-inside-a-command-in-bash January 05, 2021 at 10:06AM
没有评论:
发表评论