Skip to content

Instantly share code, notes, and snippets.

@fcojperez
Created March 14, 2023 09:25
Show Gist options
  • Save fcojperez/abeba9f60ee11b127f74268016ab1f12 to your computer and use it in GitHub Desktop.
Save fcojperez/abeba9f60ee11b127f74268016ab1f12 to your computer and use it in GitHub Desktop.
#### Bash does not have a native ternary operator. Instead, the same functionality can be achieved using:
color="blue"
[[ "$color" == "blue" ]] && echo "🟦" || echo "🟩"
# Output: 🟦
### More information here, https://how.wtf/ternary-operator-in-bash.html#ternary-operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment