Demystifying &&, ||, and ! on Linux
Monday, 11 April 2022
Add Comment
The &&, ||, and ! operators allow you to run a lot of useful commands on Linux, but you first need to get used to syntax that is a little trickier than the if-then-else command you might normally use.
To get started, I should explain that one thing the command examples in this post have in common is the use of something that I might call a shorthand “if” test. Here’s an example:
$ [ -f donuts ] $ echo %?
1
The -f donuts command asks if there is a file (-f) named “donuts”. Unless we display the return code afterwards with "echo $?", the result of the test is not displayed. In this case, it’s false (i.e., not zero), so we know the file doesn’t exist. No donuts for us!
from Network World https://ift.tt/omFdV2q
Related
Genrerating Link.... 15 seconds.
Your Link is Ready.
0 Response to "Demystifying &&, ||, and ! on Linux"
Post a Comment