IFS variable comes handy when you want to split a string into array or create a loop.

<br></br>
#!/bin/bash<br></br>
IFS=$','<br></br>
dirs='/usr/scripts,/var/lib,/usr/local'<br></br>
for dir in $dirs;<br></br>
do echo $dir;<br></br>
#or do something here<br></br>
done<br></br>
unset IFS<br></br>```

Note: Always unset the IFS variable to avoid any unwanted results.