r/bash•
Livid-Advance5536

Do you use quotes when you don't have to?

help

I know it's best practice to always encase variables in quotes, like "$HOME", but what about when it's just plain text? Do you use quotes for consistency, or just leave it?

Which of these would you write:

if [[ "$(tty)" == "/dev/tty1" ]]

if [[ "$(tty)" == /dev/tty1 ]]

if [[ $(tty) == /dev/tty1 ]]

Posted Mar 14, 2026, 12:16 AM UTC

3560
Loading comments…