Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!news From: mullins@convex.COM (Don Mullins) Newsgroups: comp.unix.shell Subject: Re: printing ksh history a la csh Message-ID: <1991Feb12.221625.7518@convex.com> Date: 12 Feb 91 22:16:25 GMT References: <2582@sapwdf.UUCP> Sender: news@convex.com (news access account) Reply-To: mullins@convex.COM (Don Mullins) Organization: Convex Computer Corporation, Richardson, TX Lines: 42 Nntp-Posting-Host: starman.convex.com In article <2582@sapwdf.UUCP> Bill Wohler 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@sap-ag.de I think the - 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@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."