Skip to main content
Tweeted twitter.com/StackUnix/status/664694109446283264
deleted 15 characters in body
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

Thanks!

Thanks!

corrected the copy method
Source Link
drwatsoncode
  • 293
  • 1
  • 3
  • 9
EXPR=$NAME[@]
arrCopy=( "${!$EXPREXPR}" )
count=${#arrCopy}
EXPR=$NAME[@]
arrCopy=( "${!$EXPR}" )
count=${#arrCopy}
EXPR=$NAME[@]
arrCopy=( "${!EXPR}" )
count=${#arrCopy}
added 3 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
  • Determine the length of an array:
    myArr=(A B C); echo ${#myArr#myArr[@]}.
  • Indirectly reference a variable by name:
    NAME=myVar; echo ${!NAME}
    (this also applies to array elements):
    NAME=myArr[1]; echo ${!NAME}
  • Determine the length of an array:
    myArr=(A B C); echo ${#myArr}.
  • Indirectly reference a variable by name:
    NAME=myVar; echo ${!NAME}
    (this also applies to array elements):
    NAME=myArr[1]; echo ${!NAME}
  • Determine the length of an array:
    myArr=(A B C); echo ${#myArr[@]}.
  • Indirectly reference a variable by name:
    NAME=myVar; echo ${!NAME}
    (this also applies to array elements):
    NAME=myArr[1]; echo ${!NAME}
added 134 characters in body
Source Link
drwatsoncode
  • 293
  • 1
  • 3
  • 9
Loading
Source Link
drwatsoncode
  • 293
  • 1
  • 3
  • 9
Loading