[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re can't the shell do a better job



On Sat, Jan 01, 2005 at 10:53:48PM -0500, cga wrote:
} Steve Lamb wrote:
[...]
} >    Well, in the one true shell, zsh, ESC-P and ESC-N will go backwards 
} >and forwards in the history respectively.  It will even take the current 
} >line as a filter so "ls" followed by multiple ESC-P will bring up my 
} >previous ls commands.
} >
} >    I always get hung up with that in bash since ESC-P does something 
} >completely different there.  Brings up a colon for some reason.  To me 
} >it means, "You're not using zsh, stupid, run chsh!"  :)
} >
} bash uses Ctrl-P and Ctrl-N.. in emacs editing mode that is..

For the sake of the few remaining tcsh users out there (it's a great
interactive shell, though terrible for scripting), it's also ESC-P and
ESC-N. Of course, I essentially always want to do a history search when
hitting up or down (the first two are for the occasional weird terminal):

bindkey ^[[A history-search-backward
bindkey ^[[B history-search-forward
bindkey -k up history-search-backward
bindkey -k down history-search-forward

I could rant about bash and how irritating it is. For one thing, it lets
you edit the history. Try it, it's really annoying; echo something, echo
something else, go up two and change what the first echo was, then go down
and echo the second thing again, then look run history and see what you
get. If I were ever going to switch my shell away from tcsh, it would
probably be to zsh.

Note that I write all my shell scripts for /bin/sh, not zsh or bash or csh
or tcsh. I even try to avoid using GNU extensions to standard tools like
sed, tr, and grep (though sometime they are just too useful to work
around). I've migrated from Ultrix to SunOS to FreeBSD to IRIX to Solaris
to Linux to MacOS X over the years and my scripts keep on working; I'm
ready for the next migration, whatever and whenever it may be (God help me,
it might be cygwin). For an interactive shell, however, nothing beats tcsh.

--Greg



Reply to: