reading and writing long dtrace command lines
By Alan Hargreaves-Oracle on Sep 14, 2004
If you read through my last dtrace adventure, you may have noticed more than a few multi-line dtrace commands.
Like most engineers, I will look for the easiest way to accomplish what I need to get done. Actually writing D-scripts into a file is only something that I'll do if things start getting a bit complex.
When I'm playing dtrace, I tend to use "ksh -o vi" as my shell.
As my scripts commands start heading toward that right margin, I use the edit option within ksh and actually lay out the command across multiple lines so I can read what I'm doing. For those that haven't tried this, it's just a matter of hitting <ESC>v while typing.
It's also a good way of evolving the commands as you go, which is the basis of a lot of dtrace-instigated investigative work.
It certainly helps me make for dtrace commands that are a little more complex than you would normally type on the command line, but not quite comlex enough to make the decision to start writing scripts.