How does && and || operators combination Work ?

commandline session

$ 4.2.29 10 510---> [ -f wordmatc.c ] || echo hello
hello
$ 4.2.29 11 511---> [ -f wordmatc.c ] || cat baty && echo hello
cat: baty: No such file or directory
$ 4.2.29 12 512---> [ -f wordmatc.c ] && echo hello || echo kitten
kitten
$ 4.2.29 13 513---> [ -f wordmatch.c ] && echo hello || echo kitten
hello
$ 4.2.29 14 514---> ls wor
wordmatch.c                                 worked
wordpress-functions-outside-wordpress.html  work-selection.php
$ 4.2.29 14 514---> ls wordmatch.c
wordmatch.c
$ 4.2.29 15 515---> ls wordmatc.c
ls: cannot access wordmatc.c: No such file or directory
$ 4.2.29 16 516--->

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s