Reset IFS variable in Mac OSX

I know, nobody could be so stupid as to set IFS directly from the command-line on their Mac whilst following a tutorial to learn how to split variables.

But just in case you’re just as stupid as me and you want to set it back to the Mac OSX default, here’s what I did.

First handy item – a command-line to display exactly what IFS is currently set to

echo -n "$IFS" | hexdump -C

Second handy item — a target to shoot for.  The answer I got from a different Mac that hadn’t been stupidly tinkered with was space, tab, newline, zero (as seen in the following hex that popped out of that command on that machine):

00000000 20 09 0a 00 | ...|

Third handy item — a command to load those values

IFS=$' \t\n\0'

After entering that string, both the normal Mac and the stupidly-tinkered-with Mac show the same values.

Most examples I came across left off the zero at the end, but I figured maybe OSX does things differently than regular Linux and tacked it on.  I’ll amend this post if things break.