Alan Hargreaves' Weblog

The ramblings of an Australian SaND TSC* Principal Field Technologist

* Solaris and Network Domain Technology Support Centre - The group I work for

Tags

(update 1) acoustic bind birthday blues bugs cec cec2007 cec2008 china cmt contention cringley debugging dogs dtrace earthquake encumbered-binaries extra flash funny google guitar halloween huron install kids linux liveupgrade locking mdb music mysql newyear niagra openjava opensolaris oracle patches patents percussion performance redhat secondlife security solaris sru sun support sxcr t2 t2000 timeslider ufs upgrade virtualbox windows youtube zfs
pageicon Tuesday Sep 14, 2004

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.

Comments:

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).

Posted by Stacey Marshall on September 16, 2004 at 06:08 AM EST #

Post a Comment:
Comments are closed for this entry.