printing ksh history a la csh

Bill Wohler wohler at sapwdf.UUCP
Wed Feb 13 02:41:11 AEST 1991


folks,

  in ksh, i'd like to say "history 30" to print the last 30 commands as
  in csh.  if you know how to do this, i would be obliged.

  the problem is that the "fc -l" command optionally asks for the first 
  and last command of your list.  there aren't any variables that i
  know of that contain the current history number which one could subtract
  30 from and pass to fc -l.

  another "feature" of our ksh is that if you specify a starting
  number that is too low, instead of printing just what it knows, it
  prints the following useful message (are you listening, ibm?):

    /bin/ksh: fc: 0403-009 The specified number is not valid for this command.

  thus, such a history alias would have to ensure that it doesn't try
  to print commands $HISTSIZE commands ago.

						--bw
						wohler at sap-ag.de



More information about the Comp.unix.shell mailing list