"let" in BASH

Hello everybody here..

Should I use "let" command in BASH? Why its not that rarely used in BASH examples and books?

Thanks

Hi,

You can search on google, but a website which is a reference

http://www.tldp.org/LDP/abs/html/internal.html#EX46

The "let" command originated in ksh. Dave Korn considered it to be a mistake and very quickly developed the double parentheses notation to replace it. By the mid 1980's the advice was to not use the "let" command in new code. However the let command is still available. It is intended for legacy code. bash copied ksh arithmetic including both the double parentheses and the "let" command. And the bash team followed Dave's lead in not recommending the "let" command.

I started using ksh in the late 80's. The "let" command had been deprecated for several years even back then. I have been writing ksh scripts form over a quarter of a century. I don't believe that I have ever used "let". I don't believe that I ever will.

2 Likes

Thank you sir, you made it clear! I have posted this question due to an internet book about BASH, the book name is "Advanced Bash-Scripting" for Mendel Cooper. I found many of the examples use "let"! and that what made me curious to know the truth :slight_smile: