Alan Hargreaves' Blog

The ramblings of a former Australian SaND TSC* Principal Field Technologist

reading and writing long dtrace command lines

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.


Written by Alan

September 13, 2004 at 4:48 pm

Posted in Solaris Express

One Response

Subscribe to comments with RSS.

  1. Within ksh emacs mode use ^X^E to accomplish the same edit trick** You can specify the editor by setting the environment variable VISUAL or EDITOR; if neither is set then the default ‘vi’ is used.
    ** Works happily with ksh Version “M 1993-12-28 p”. Alas the standard Solaris ksh 88 in /usr/bin does not have the emacs feature enabled. While ksh93 ( /usr/dt/bin/dtksh) cores with SIGSEGV for me (note neither man page mentions the feature).

    Stacey Marshall

    September 15, 2004 at 1:08 pm

Comments are closed.

%d bloggers like this: