BASH   30

undecidable parse sh

Guest on 13th May 2022 01:42:25 AM

  1. #!/bin/bash
  2.  
  3. if test $# -eq 0; then  # any arguments?
  4.   declare -a array      # regular array
  5. else
  6.   declare -A array      # associative array
  7. fi
  8.  
  9. b=1
  10. array[X=b+2*3]=c        # What does this mean?
  11.  
  12. echo "Index: ${!array[@]}"
  13. echo "Value: ${array[@]}"
  14. echo "X:     ${X:-undefined}"

Raw Paste


Login or Register to edit or fork this paste. It's free.