2

While I'm searching for bash examples, I find the let command but I never understand it.

I saw the man bash, also I couldn't understand what let expression does.

Some let usage that I saw:

  • let z=z+3

  • let "z += 3"

What is the usage of let?

Any explained example will be appreciated.

cuonglm
  • 150,973
  • 38
  • 327
  • 406
Yunus
  • 1,634
  • 2
  • 13
  • 19
  • 4
    I invite you to read http://unix.stackexchange.com/q/149823/38906 – cuonglm Nov 06 '15 at 03:38
  • thank you ! so according to your question there , is let a="3 * (2 + 1)" replaces a=$((3 * $((2 + 1)))) , and is it meant to do only such job ?... – Yunus Nov 06 '15 at 03:44
  • They did the same job, and `let` is the same as `((...))`. You should read Stephane answer http://unix.stackexchange.com/a/149916/38906 for more detail. – cuonglm Nov 06 '15 at 03:50
  • oh yeah i was reading it , and i got it ! many thanks bro :3 – Yunus Nov 06 '15 at 03:57

0 Answers0