Repeat last command

Repeat last command

Post by Ja.. » Sat, 14 Sep 1996 04:00:00



Hi all,

We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
know how to get to the last few commands you have typed in?  i.e. up
arrow, esc K.  Im sure I need something in the .profile but what?

TIA!


 
 
 

Repeat last command

Post by Kurt J Lan » Sat, 14 Sep 1996 04:00:00



>Hi all,
>We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
>know how to get to the last few commands you have typed in?  i.e. up
>arrow, esc K.  Im sure I need something in the .profile but what?

You need to be running a different shell. The Bourne shell
does not have command history. I believe both the C shell
and Korn shell do. "man sh", "man csh", "man ksh" to see the
differences. Hope this helps.
--
--


 
 
 

Repeat last command

Post by Thomas R. Stevens » Sat, 14 Sep 1996 04:00:00




> >Hi all,

> >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> >know how to get to the last few commands you have typed in?  i.e. up
> >arrow, esc K.  Im sure I need something in the .profile but what?

> You need to be running a different shell. The Bourne shell
> does not have command history. I believe both the C shell
> and Korn shell do. "man sh", "man csh", "man ksh" to see the
> differences. Hope this helps.

Or if you want to install a new shell on your system, I suggest the
bash shell. It allows for using arrow keys to move up and down the
history list.

--


      /   /_/  /_    VMail:     (313) 577-4742
     /.  /\.  __/.   Fax:       (313) 577-5626
                     Home Page: http://tom.cc.wayne.edu
                     Anon FTP:  ftp://tom.cc.wayne.edu

   For my PGP PUBLIC KEY BLOCK,

"A common mistake that people make when trying
 to design something completely foolproof was         Douglas Adams
 to underestimate the ingenuity of complete           Mostly Harmless
 fools."

 
 
 

Repeat last command

Post by Alan H. Ka » Sat, 14 Sep 1996 04:00:00



> Hi all,

> We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> know how to get to the last few commands you have typed in?  i.e. up
> arrow, esc K.  Im sure I need something in the .profile but what?

If you're using sh you can't. Ksh or csh have history mechanisms as well
as some other shells.

--
Alan H. Katz          | MJ Research, Inc.

617-370-8128          | Watertown, MA 02172
Fax 617-923-8080      |

 
 
 

Repeat last command

Post by Edsel Ada » Tue, 17 Sep 1996 04:00:00



> Hi all,

> We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> know how to get to the last few commands you have typed in?  i.e. up
> arrow, esc K.  Im sure I need something in the .profile but what?

> TIA!



set -o vi
export EDITOR=vi

Then magically esc-k works.  (provided you are using the Korn shell)

--
Edsel Adap   OPCOM Consultant   SUN Microsystems Developer Support
Center

Opinions expressed are my own and do not represent Sun Microsystems.

 
 
 

Repeat last command

Post by Christopher Bowe » Tue, 17 Sep 1996 04:00:00


Quote:

> >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> >know how to get to the last few commands you have typed in?  i.e. up
> >arrow, esc K.  Im sure I need something in the .profile but what?

> You need to be running a different shell. The Bourne shell
> does not have command history. I believe both the C shell
> and Korn shell do. "man sh", "man csh", "man ksh" to see the
> differences. Hope this helps.

   Korn shell does.  
type  'set -o emacs'  at the prompt (no quotes) or put it in your .profile
or .kshrc.  Then use ^p and ^n for previous and next commands..

don't know much about Csh version of this.. would like to tho..

- Christopher
-------------------------------------------------------------------------
      Sysadmin/rs6000           |"You can hit me there and you can hit  |
  Mathematics Computer Lab      | me there but you can't hit me there."
   University of Toronto        |                                       |
-------------------------------------------------------------------------

 
 
 

Repeat last command

Post by susan cassi » Wed, 18 Sep 1996 04:00:00



>Hi all,

>We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
>know how to get to the last few commands you have typed in?  i.e. up
>arrow, esc K.  Im sure I need something in the .profile but what?



I would recommend using the Korn shell (as opposed to csh).  Just set
the environment variable VISUAL to your preferred editor (usually
/usr/bin/vi), and export it.  The HZ variable is usually set for you
to 100 on NCR SVR4 unix.  There are also some aliases set up.

After you are set up, then Escape k will show you the previous command,
and you can edit it just like you were in vi.  Subsequent Escape k's
will take you further back (of course, it only knows the commands
you entered since you started the ksh).  You can also do things like
r command, which will repeat the last command you entered, for
example r pg  will redo the last pg command you entered.  You can
check the ksh man page for more details.

--
Susan Cassidy

 
 
 

Repeat last command

Post by Brian Duan » Wed, 18 Sep 1996 04:00:00




> >Hi all,

> >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> >know how to get to the last few commands you have typed in?  i.e. up
> >arrow, esc K.  Im sure I need something in the .profile but what?


> I would recommend using the Korn shell (as opposed to csh).  Just set
> the environment variable VISUAL to your preferred editor (usually
> /usr/bin/vi), and export it.  The HZ variable is usually set for you
> to 100 on NCR SVR4 unix.  There are also some aliases set up.

> After you are set up, then Escape k will show you the previous command,
> and you can edit it just like you were in vi.  Subsequent Escape k's
> will take you further back (of course, it only knows the commands
> you entered since you started the ksh).  You can also do things like
> r command, which will repeat the last command you entered, for
> example r pg  will redo the last pg command you entered.  You can
> check the ksh man page for more details.

> --
> Susan Cassidy


The HZ variable is timer related and defines the number of ticks per
second.  I think the variable you are referring to is HISTSIZE which
(from memory) has a default value of 128.  Another associated variable
is HISTFILE.
--
Brian Duane - NCR Corporation
(Formerly AT&T GIS, formerly NCR)

 
 
 

Repeat last command

Post by Marin Laza » Wed, 18 Sep 1996 04:00:00



> > >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> > >know how to get to the last few commands you have typed in?  i.e. up
> > >arrow, esc K.  Im sure I need something in the .profile but what?

> > You need to be running a different shell. The Bourne shell
> > does not have command history. I believe both the C shell
> > and Korn shell do. "man sh", "man csh", "man ksh" to see the
> > differences. Hope this helps.

>    Korn shell does.
> type  'set -o emacs'  at the prompt (no quotes) or put it in your .profile
> or .kshrc.  Then use ^p and ^n for previous and next commands..

> don't know much about Csh version of this.. would like to tho..

> - Christopher
> -------------------------------------------------------------------------
>       Sysadmin/rs6000           |"You can hit me there and you can hit  |
>   Mathematics Computer Lab      | me there but you can't hit me there."
>    University of Toronto        |                                       |
> -------------------------------------------------------------------------

If you really want to get a nice thing that you should look for
bash (program). It's free and can give the latest 500 by pressing
the arrow keys. You can even setup your promt to look like

youl'll always see that in you prompt.


 
 
 

Repeat last command

Post by joh » Thu, 19 Sep 1996 04:00:00



: >

: >
: > >

: > >
: > > >Hi all,
: > >
: > >
: > > >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
: > > >know how to get to the last few commands you have typed in?  i.e. up
: > > >arrow, esc K.  Im sure I need something in the .profile but what?
: > >
export EDITOR=vi

John

 
 
 

Repeat last command

Post by susan cassi » Thu, 19 Sep 1996 04:00:00






>> >Hi all,

>> >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
>> >know how to get to the last few commands you have typed in?  i.e. up
>> >arrow, esc K.  Im sure I need something in the .profile but what?


>> I would recommend using the Korn shell (as opposed to csh).  Just set
>> the environment variable VISUAL to your preferred editor (usually
>> /usr/bin/vi), and export it.  The HZ variable is usually set for you
>> to 100 on NCR SVR4 unix.  There are also some aliases set up.

>> After you are set up, then Escape k will show you the previous command,
>> and you can edit it just like you were in vi.  Subsequent Escape k's
>> will take you further back (of course, it only knows the commands
>> you entered since you started the ksh).  You can also do things like
>> r command, which will repeat the last command you entered, for
>> example r pg  will redo the last pg command you entered.  You can
>> check the ksh man page for more details.

>> --
>> Susan Cassidy

>The HZ variable is timer related and defines the number of ticks per
>second.  I think the variable you are referring to is HISTSIZE which
>(from memory) has a default value of 128.  Another associated variable
>is HISTFILE.
>--
>Brian Duane - NCR Corporation
>(Formerly AT&T GIS, formerly NCR)


Sorry, I should have looked it up - went from a quick look at my environment.
--
Susan Cassidy

 
 
 

Repeat last command

Post by Michael Moh » Fri, 20 Sep 1996 04:00:00





> > >Hi all,

> > >We have a couple boxs with AT&T/NCR UNIX (SVR4) on them.  Would anyone
> > >know how to get to the last few commands you have typed in?  i.e. up
> > >arrow, esc K.  Im sure I need something in the .profile but what?

> > You need to be running a different shell. The Bourne shell
> > does not have command history. I believe both the C shell
> > and Korn shell do. "man sh", "man csh", "man ksh" to see the
> > differences. Hope this helps.
> --

To enable the action you want, it may be something as simple as creating
an .editreadrc file in your home directory.  I know some versions of the
shell programs will not permit command editing unless .editreadrc is
present.  Again, this comes down to what the man pages state about your
shell.
================================================================

Information Technology Group      === Phone: 64 9 307-9999 x8133
Auckland Institute of Technology  === Fax:   64 9 307-9901
PO Box 92006, Auckland, New Zealand =
================================================================
If we have unlimited ability to think, why do we use computers?
 
 
 

Repeat last command

Post by David Spesso » Fri, 20 Sep 1996 04:00:00


Quote:> You need to be running a different shell. The Bourne shell
> does not have command history. I believe both the C shell
> and Korn shell do. "man sh", "man csh", "man ksh" to see the
> differences. Hope this helps.

The tcsh shell also has command history. In fact, by pressing the up
arrow and down arrow keys, you can scroll through the history. It also
supports command line editing.

In any case, most prompts can be given a sequential number (such as set
prompt = "blah [\!] " for csh) whereupon you can type !n to repeat
command number n. You can also repeat the last command that starts with
blah by typing !blah. In addition, !! repeats the last command.
--
David Spessot

 
 
 

Repeat last command

Post by Timothy Clarkso » Fri, 20 Sep 1996 04:00:00


If you are running a "ksh" you need the environment varible =
EDITOR=3Dvi;export EDITOR.

and then you can use ESC-k (Up), ESC-j (Down)

Timothy Clarkson

 
 
 

Repeat last command

Post by Doug O'Ne » Sat, 21 Sep 1996 04:00:00


: If you really want to get a nice thing that you should look for
: bash (program). It's free and can give the latest 500 by pressing
: the arrow keys. You can even setup your promt to look like

: youl'll always see that in you prompt.


You can do the same thing in ksh and ksh is a supported shell on most
modern systems.  Add the following to your .profile
set -o emacs
alias __A="^P"
alias __B="^N"
alias __C="^F"
alias __D="^B"
export HISTSIZE=500

Doug
--
Douglas O'Neal, Senior Systems Programmer, Johns Hopkins University

"Hypothetical questions get hypothetical answers" - Joan Baez