Arrays in POSIX Shell


/ Published in: Bash
Save to your folder(s)

Arrays in POSIX Shell


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.