Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnews!lvc From: lvc@cbnews.att.com (Lawrence V. Cipriani) Newsgroups: comp.unix.shell Subject: Re: printing ksh history a la csh Message-ID: <1991Feb12.230050.17182@cbnews.att.com> Date: 12 Feb 91 23:00:50 GMT References: <2582@sapwdf.UUCP> Organization: Ideology Busters Inc. Lines: 27 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. $ history -30 > another "feature" of our ksh is that if you specify a starting > number that is too low, instead of printing just what it knows, This has been a sore point with me for a long time as well. I have asked Korn to change ksh so that it would do this but it was not done. You could do something like this: ncmd="`history -1 | sed -e 's/[ ].*//' -e 1d`" if [ "$ncmd" -gt "$HISTSIZE" ] then ncmd=$HISTSIZE fi history -$ncmd That's the basic idea at least. -- Larry Cipriani, att!cbvox!lvc or lvc@cbvox.att.com "Fight fire with fire, I always say" -- Bugs Bunny