Posted By

biiont on 09/09/14


Tagged

Shell POSIX dash


Versions (?)

Arrays in POSIX Shell


 / Published in: Bash
 

Arrays in POSIX Shell

  1. # Prepare array
  2. A=; for i in a b c d; do A="$A$i:"; done; echo $A;
  3.  
  4. # Iterate over
  5. while [ -n "${A}" ]; do I="${A%%:*}"; echo "${I}"; A="${A#*:}"; done

Report this snippet  

You need to login to post a comment.