Bash expansion

I had posted about the weird behavior of bash expansion, but I think I just ran across a wiki page that discusses this issue.

The key issue seems to be the order of expansions:

  1. Syntax analysis (Parsing)
  2. Brace expansion
  3. Tilde expansion
  4. Parameter and variable expansion
  5. Command substitution
  6. Arithmetic expansion
  7. Word splitting
  8. Filename expansion
  9. Quote removal

Command substitution happens after brace expansion, but before filename expansion (which * expansion is). Similarly, if you attempt to do tilde expansion, it also “won’t work”:

maciek@anemone:~$ echo $(echo \~)

Mystery solved. I ran across this when trying to figure out what was it that eval did that’s more interesting than spawning a new subshell. Clearly, the answer is that it lets you get a second pass through these steps, which can definitely be handy.


Fun with IOWait

I’ve been having intermittent problems with IOWait rendering my laptop completely unusable for minutes at a time after a resume from suspend. I’m not a stickler for performance–I can forgive a little slugishness (in fact, back in the day, I played through GTA III with my brother on a system that was absurdly underpowered for the task, and we’d be lucky to get frame rates above the single digits–but I digress), but it’s just not possible to do anything when the system is like that.

I’ve added the system monitor applet to my taskbar and set the IOWait to show up red (it’s a dark blue that’s almost invisible against the black idle by default). Here is one particularly egregious session:


IOWait, 20 minutes later

That’s right: it’s still pegged twenty minutes later. Almost completely unusable the entire time. I haven’t found what could be causing this. There’s an old Ubuntu bug report, but it doesn’t really shed much light on the situation. It seems to blame fglrx, but it links to an older report that doesn’t even mention fglrx.

Bleah. This makes Firefox’s fsync problems look like a Duff’s-device-grade performance optimization.