General, not OSX-specific or linux-specific, and see also shells to yak-shave your way into whole other shell paradigms. Or fish for a less awful user experience.
I just don’t care enough to remember. This makes me a Bad Hacker.
Watch out for horrible problems with handling of delimeters. Anyway, for loops are not insane.
#!/bin/bash for i in $( ls ); do echo item: $i done
!n - the nth history, !-n the nth-most-recent !string refers to the most recent command in the history starting with string, !?string[?] refers to the most recent command containing string