Return to Snippet

Revision: 67323
at September 10, 2014 01:42 by biiont


Updated Code
# Prepare array
A=; for i in a b c d; do A="$A$i:"; done; echo $A;

# Iterate over
while [ -n "${A}" ]; do I="${A%%:*}"; echo "${I}"; A="${A#*:}"; done

Revision: 67322
at September 10, 2014 01:33 by biiont


Updated Code
# Prepare array
A=; for i in a b c d; do A="$A$i:"; done; echo $A;

# Iterate over
while [ -n "${A#:*}" ]; do I="${A%%:*}"; echo "${I}"; A="${A#*:}"; done

Revision: 67321
at September 9, 2014 21:26 by biiont


Initial Code
A="a:b:c"; CDR="${A}:"; while [ -n "${CDR}" ]; do CAR="${CDR%%:*}"; CDR="${CDR#*:}"; echo "${CAR}"; done

Initial URL


Initial Description
Arrays in POSIX Shell

Initial Title
Arrays in POSIX Shell

Initial Tags


Initial Language
Bash