Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 58 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. myArray=('1' '2' '3' '4' '5')
  2.  
  3. myFunction ()
  4. {
  5. local -n myList="$1";
  6. echo "${myList[@]}";
  7. }
  8.  
  9. myFunction myArray
  10.    
  11. 1 2 3 4 5
  12.    
  13. myArray=('1' '2' '3' '4' '5')
  14. myFunction () { local arr="${1}[@]"; local values=( "${!arr}" ); echo "${values[@]}"; }
  15. # .........................^^^^^^^ ..................^^^^^^^
  16. #               array expansion *as a string*     actual array expansion
  17. myFunction myArray
  18.    
  19. 1 2 3 4 5
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top