Skip to main content

Posts

Showing posts with the label lt

Linux "-f" or linux "-z" or linux "-eq" or linux "-gt" ... ?

Often friends and people that I know that start to have an interest in Linux end up doing shell scripting and they get their ears caught. I usually get e-mails with questions like this: What is linux "-f" or linux "-z" or linux "-eq" or linux "-gt" or linux "-rf" or linux "-le" ? The short answer for the above is that those are number and file tests/comparisons of korn/bash shells. Linux shells are the primary ways the users interact with Linux operating systems. With shells you can interact with the file system and execute programs. You can chain shell commands in scripts in a programmatic way. Number and file tests/comparisons occur in shell scripting constructs such as : if [ true ] then # do something here fi You can replace the "true" between the [] with expressions that evaluate to true or false, for example: if [ 5 -eq 5 ] then echo "5 equals 5" fi The above decisional block in ...