It is currently Tue, 16 Sep 2014 02:24:02 GMT



 
Author Message
 What am I missing? Command line history

  I have always relied on command line history and all the associated
shortcuts (!!, !-2, etc ...) to make working at the command line
faster/easier.  How can I use this under SCO Unix?  None of the versions I
have dealt with have had command line history enabled / installed.  Is an
additional software package necessary, or am I overlooking anything?

Thanks for any help

--
bm...@best.com



 Thu, 01 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

B M Weiss (bm...@best.com) wrote:

: I have always relied on command line history and all the associated
: shortcuts (!!, !-2, etc ...) to make working at the command line

Argh!  C-shell.

You have history if you're using Csh or Ksh.  Bourne shell doesn't
have any history.  You can also install Bash.  I would strongly
advise you use Ksh instead of Csh.  The command line editing using
vi or emacs style commands is well worth the exercise.

The trick to using Ksh is to put together a workable set
of aliases.  This is a partial list of my aliases.  Note that
"h" will list the last 10 commands.

set -o vi                       # Set command line editing mode
set -o allexport                # Export ALL variables
set -o ignoreeof                # Dont crash out on ctrl-D
HISTFILE='.sh_hist'             # Name of history file
alias   a=alias                 # I hate typing "alias"
a       h='fc -l'               # history alias
a       bye=exit                # logout
a       cls=clear               # dos: clear the screen
a       md=mkdir                # dos: make a directory
a       rd=rmdir                # dos: remove a directory
a       dir="lf -a"           # dos: wide directory listing

To actually use command line editing is Korn Shell, you need to
know the vi editor.  Try this sequence:

1.  Run a few random commands to build the history file.
2.  Hit <esc>
3.  Hit "j" or "k" to scroll up and down the history stack.
4.  You can edit the line with any of the vi commands.  The
handiest is "i" for insert and "x" to delete a character.
5.  You can search the history stack with:
        /keyword
where "keyword" is a substring found in some previous command.
Hit "n" or "N" to scroll through the list.
6.  To clear a line so that you don't execute it by accident "dd".
7.  You can save a list of your last 100 commands (for evidence):
        h -100 > filename

In my never humble opinion, Ksh is much better than Csh.

[x] Email to author  [ ] To mailing list  [x] Posted to newsgroup
--
# Jeff Liebermann  Liebermann Design  150 Felker St #D  Santa Cruz  CA  95060
# 408.336.2558 voice  wb6ssy@ki6eh.#cenca.ca.usa  wb6ssy.ampr.org 44.4.18.10
# 408.699.0483 digital_pager    73557,2074  cis [don't]
# je...@comix.santa-cruz.ca.us  http://www.cruzio.com/~jeffl



 Fri, 02 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

That's the csh style of command-line history.  You need to use csh for
it to be available.  (Unfortunately, OpenServer's csh is a sorry piece
of garbage that should have been deleted 10 years ago.  Fortunately,
tcsh is readily available, for instance on the Skunkware 5 CD -- look on
ftp.sco.com under /Skunk2/CD-ROM.)

Let me also guess that you're talking about the root account.  Do *not*
change root's shell to csh or tcsh; bad things will ensue.  Either run
[t]csh manually when you login as root, or make a separate "rootcsh"
account with [t]csh as its shell.  See:

  http://www.sco.com/cgi-bin/ssl_reference?482175



 Sat, 03 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

... unless you fix the small number of root-shell-specific parts of the
startup scripts so that they are no longer root-shell-specific, being:

/etc/authckrc and /etc/bcheckrc in 3.2.4.2
those plus /etc/netbios, /etc/snmp and /etc/tcp in 3.2.4.2/ODT3 with TCP/IP

/etc/authckrc, /etc/scohttp and /etc/rc2.d/P93scohttp in 3.2.5.0.0
those plus /etc/rc2.d/S80lp in 3.2.5.0.2

--
Craig Macbride  <cr...@rmit.edu.au>        URL: http://www.bf.rmit.edu.au/~craigm

"I'm not sure that actually made sense but I'm afraid that if I tried to go
back and figure it out, I would start bleeding from my ears."
- Londo, Babylon 5, "Convictions"



 Sat, 03 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

 [command history]

 Jeff> To actually use command line editing is Korn Shell, you need to
 Jeff> know the vi editor.  Try this sequence:

Ahhh... not again.

To use the cursor keys for command history, do this in your .kshrc:

set -o emacs
alias __A="$(print '\020')"
alias __B="$(print '\016')"
alias __C="$(print '\006')"
alias __D="$(print '\002')"

That works for the console, and any vaguely ANSI-ish terminal (VT100 etc.
must have cursor keys in 'normal' mode).

See the ksh manpage for the other editing functions available in emacs
mode.

[Just another vi-hater]

--
Andrew Gierth (andr...@microlise.co.uk)

"Ceterum censeo Microsoftam delendam esse" - Alain Knaff in nanam



 Sat, 03 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

In article <bmw01-1310962143240...@nntp.best.com> bm...@best.com (B M Weiss) writes:
You are talking about command line editing for the C-shell.  SCO
systems have come with C-shell and Korn shell, as well as the original
Unix Bourne shell (which has no history).  I much prefer the Korn
shell, as it executes Bourne shell scripts (plus some additions),
which are much more powerful than the C-shell scripting capabilities.
I also find the history much easier to use.  

To set up history for C-shell, as I recall, you have to have a
"history" operator with a number in your .cshrc.  The prototypes SCO
provides (in /usr/lib/mkuser on my ODT 2 system) which are mapped into
new user directories when they are added are good starting points for
each of the shells.  Also note the /etc/profile and /etc/cshrc files,
which are executed before the local directory files on login.  

To get history and editing on Korn shell (/bin/ksh), you have to
specify an editor in the environment.  I use
EDITOR=vi
VISUAL=$EDITOR
export VISUAL EDITOR

in my .profile files.  I include this in the root directory as well,
although I have strong feelings that all machines should always use
/bin/sh as the root login shell.  If I want Korn shell features, I
simply type ksh at the command prompt.  

If you want to use Emacs-style editing, and use Emacs on your system,
substitute EDITOR=emacs in the above.  There are other ways to specify
the editor to ksh (man ksh for details).  

You may expect up-arrow and down-arrow command recall.  That is a DEC
peculiarity, added to their csh and ksh on Ultrix systems (and, I
think, on their OSF-1/DEC Unix product).  The standard ksh vi editing
is hjkl positioning. The editing is strictly vi---no ex commands.  

Be serious about using /bin/sh and nothing else as the root login
shell.  I've forgotten all the pitfalls of using another shell in
root, but if you use another shell, particularly csh or tcsh, which
won't handle Bourne shell script language, you'll get burned badly
sooner or later.  I wouldn't advise ksh either.  If you want another
shell when working as root, either add another account at uid/gid 0:0
with another login name, or accept invoking your favored shell over
the Bourne shell when you are working in root.  

--
===================================================================
Hank van Cleef
E-mail vancl...@netcom.com or vancl...@tmn.com  
===================================================================



 Sun, 04 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

 [command line editing]

 Henry> You may expect up-arrow and down-arrow command recall.  That
 Henry> is a DEC peculiarity, added to their csh and ksh on Ultrix
 Henry> systems (and, I think, on their OSF-1/DEC Unix product).  The
 Henry> standard ksh vi editing is hjkl positioning. The editing is
 Henry> strictly vi---no ex commands.

I beg to differ - every ksh I've ever used (HP-UX 9 and 10, AIX 3.2, SVR4,
SCO 3.2v4 and 3.2v5) has been able to use cursor keys for command history.

 Henry> Be serious about using /bin/sh and nothing else as the root login
 Henry> shell.  I've forgotten all the pitfalls of using another shell in
 Henry> root, but if you use another shell, particularly csh or tcsh, which
 Henry> won't handle Bourne shell script language, you'll get burned badly
 Henry> sooner or later.  I wouldn't advise ksh either.  If you want another
 Henry> shell when working as root, either add another account at uid/gid 0:0
 Henry> with another login name, or accept invoking your favored shell over
 Henry> the Bourne shell when you are working in root.  

/bin/ksh as root's shell has never caused me any problems.

--
Andrew Gierth (andr...@microlise.co.uk)

"Ceterum censeo Microsoftam delendam esse" - Alain Knaff in nanam



 Sun, 04 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

I checked this out on some boxes at work today.  HPUX 10.10 has
ksh-style history on Bourne shell.  None of the following have arrow
positioning on ksh: HPUX 10.10, Irix 5.3, SunOs 5.5 (Solaris).  The
SVR4 ksh (I examined the 4.2 source a while back) had no arrow key
handling.  The DEC versions (once again, from examining and working
with source) used termcap curses functions to decipher the keystroke
escape sequences.  Can't comment on AIX---I can log onto a machine,
but playing Irix and HP-UX wizard is enough for one of me.  I will
probably boot Irix 6.2 tomorrow (the machine has two boot disks) and
might think to check it out.  No doubt somebody has done something
about deciphering the arrow key escape sequences, but I haven't run
into it.  I normally use hjkl positioning with vi, so have to stop to
think and try it even if arrow key positioning is available with a
shell.  I'll also be installing HP-UX 10.20 tomorrow in a twin boot
setup, so might try it.  

Yet.  Generally ksh will work in root for most things.  As I noted,
most problems are with Bourne-type shell scripts being fed to a
csh-type interpreter.  
--
===================================================================
Hank van Cleef
E-mail vancl...@netcom.com or vancl...@tmn.com  
===================================================================



 Tue, 06 Apr 1999 03:00:00 GMT   
 What am I missing? Command line history

 [command line editing]

 Henry> You may expect up-arrow and down-arrow command recall.  That
 Henry> is a DEC peculiarity, added to their csh and ksh on Ultrix
 Henry> systems (and, I think, on their OSF-1/DEC Unix product).  The
 Henry> standard ksh vi editing is hjkl positioning. The editing is
 Henry> strictly vi---no ex commands.

 AG> I beg to differ - every ksh I've ever used (HP-UX 9 and 10, AIX 3.2, SVR4,
 AG> SCO 3.2v4 and 3.2v5) has been able to use cursor keys for command history.

 Henry> I checked this out on some boxes at work today.  HPUX 10.10 has
 Henry> ksh-style history on Bourne shell.  None of the following have arrow
 Henry> positioning on ksh: HPUX 10.10, Irix 5.3, SunOs 5.5 (Solaris).  The
 Henry> SVR4 ksh (I examined the 4.2 source a while back) had no arrow key
 Henry> handling.

Um. I said "has been able to use cursor keys". You still need to supply the
magic aliases yourself. On HPUX 10.10, they work for /sbin/sh and /bin/sh
as well as for /bin/ksh (/sbin/sh and /bin/sh are, apparently, POSIX shells).

I use all the systems I mentioned pretty much every day at the moment. I
rather like being able to use the cursor keys...

--
Andrew Gierth (andr...@microlise.co.uk)

"Ceterum censeo Microsoftam delendam esse" - Alain Knaff in nanam



 Tue, 06 Apr 1999 03:00:00 GMT   
 
   [ 9 post ] 

Similar Threads

1. rememeber history of tcshell command line commands after reboot

2. Command Line/History Editor??

3. tab completion and command line history

4. Command Line/History Editor??

5. bash command line history/editing

6. How to copy history to command line?

7. Looking for a command line history util

8. Command line history for programs (or atty)

9. Command line history.

10. ksh command line history


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software