[ -r file ] && echo 'readable'

Category: Bash Scripting

[ -r file ] && echo 'readable'

Short-circuit AND: run second command only if first succeeds

Short-circuit AND: run the second command only if the first succeeds (exits with 0). Like 'if A then do B'.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.