December 2008
Intermediate to advanced
320 pages
6h 45m
English
One of the fundamental elements of programming is the ability to make comparisons: you test for certain conditions to be able to make decisions. You can use the test command to evaluate many items, such as variables, strings, and numbers. I keep the information in this appendix close at hand since I haven't memorized all of the parameters. I often use these switches for checking files and strings, and this is a simple quick reference for easy lookup. Note that in Table A-1 the "test" column refers to the system command test such as /usr/bin/test. The "bash" and "ksh" columns refer to the built-in test command for those shells.
Table A-1. Test Switches
| Switch | test | bash | ksh | Definition |
-a FILE |
✓ | ✓ | FILE simply ... |
Read now
Unlock full access