Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The bash syntax for arrays is obtuse and no one will spot when an error creeps in. It's worth to make an effort to say with space separated strings, as long as you are with bash. More advanced data structures is often an indication that it's worth glacing at something like python.

Should you need to handle spaces, it is often much easier to go with newline separated strings and use "| while read".

This contruction has the added benefit of the data not needing to fit in your environment. This can be a real issue, and is not at all obvious when it happens.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: