DEV Community

Cover image for if on the command line
Francisco Chaves
Francisco Chaves

Posted on

if on the command line

Hello guys, today I will leave a quick tip on how to make comparisons on the Linux command line using Shell Script.

Examples:

[ 1 == 1 ] && echo 1 || echo 0
Enter fullscreen mode Exit fullscreen mode

Result is 1

[ 1 == 3 ] && echo 1 || echo 0
Enter fullscreen mode Exit fullscreen mode

Result is 0

Top comments (0)