printing ksh history a la csh

Don Mullins mullins at convex.COM
Wed Feb 13 09:16:25 AEST 1991


In article <2582 at sapwdf.UUCP> Bill Wohler <wohler at sap-ag.de> writes:
>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.
>
>						--bw
>						wohler at sap-ag.de

    I think the -<num> option is what you want (transcript follows..)
------------------------ PROMPT IS '$' -------------------------------
$ alias history
history=fc -l
$ history -30
15146   cls
15147   lf
.....   [deleted for brevity -dwm]
15172   lf
15173   trn
15174   history -20
15175   alias history
15176   history -30
$ what /bin/ksh
/bin/ksh
	Version 11/16/88
	sleep.c 4.6 (Berkeley) 9/11/83
$

----------------------------------------------------------------------

Don

--
Don Mullins          Convex Computer Corporation          Richardson, Texas USA
INTERNET: mullins at convex.COM -- UUCP: {uiucuxc, uunet, sun, ...}!convex!mullins
              Mullins' 1st Law of Statistical Presentation: 
"Never present numbers as an integer value, people won't believe they're valid."



More information about the Comp.unix.shell mailing list