Over a million developers have joined DZone.

Bash Snippet: Split text and loop through the result

·

Splitting text and looping through the result

separator=':'
text_to_split=$PATH

paths=(`echo $PATH | tr $separator ' '`)

cant=${#paths[*]}
i=0
while [ $i -lt $cant ]; do
        echo ${paths[$i]}
	let i++
done
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}