I have a Bash script on Cygwin that tries to iterate through the directory entries in PATH. I need to convert the PATH value to a form that I can iterate through with "for var in $list; do".
For instance, an excerpt from my PATH value is this:
:/c/Program Files/Windows Imaging/:/c/Program Files/MySQL/MySQL Server 5.1/bin
I need to somehow coerce this into something I can iterate through, where each original PATH entry goes into a variable.
I tried replacing " " (space) with "\ " (escaped space). That seems correct, but I also have to replace ":" (colon) with " " (space). I also tried replacing ":" with "\n", but that doesn't seem to help. Inside the "for" loop, the value of "var" never includes the full directory name, it always breaks at spaces in the names.
---------- Post updated at 04:40 PM ---------- Previous update was at 04:22 PM ----------
Duh. Never mind. I discovered "IFS=$':'". Very simple.