Translate

Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Operating System Concepts
Image of Modern Operating Systems (3rd Edition)

Bash and Korn Shell Let Keyword

Recently a colleague of mine recommended using the let keyword in shell scripts to perform arithmetic evaluation. That prompted me to write this post about the let keyword. Here is what the bash manpage says about the let keyword: let arg [arg …] Each arg is an arithmetic expression to be evaluated. If the last arg evaluates to 0, let returns 1; 0 is returned otherwise. And here is a simple example of it’s use: $ a=2 $ b=5 $ let c=$a+$b $ echo $c 7 $ let c=$a + $b $ echo $c 2 As you can see from