wanted: cshell for systemV

chris chris at globetek.UUCP
Wed Jan 1 02:14:30 AEST 1986


In article <397 at mordred.purdue.UUCP> fjn at purdue.UUCP (Francie J Newbery) writes:
>Surely I am not the first person to be hankering for cshell when 
>I have to switch from my 4.2BSD Vax to my SystemV Release 2 machine.
>If anyone has developed such a program (even a simplified version)
>and would be willing to share it, I would be very interested in 
>seeing a copy.
>
>Thanks,
>Francie Newbery

Funny you should ask for this.  Last Sunday I got so frustrated having no
command history when dialing into a local system from home that I spent the
next 7 hours amusing myself by implementing a cshell-like front-end for the
Bourne shell.  Ok, you say, very industrious, but why was it amusing?  Well,
I implemented it as a 400-line *Bourne Shell script*!  Funny thing is, it's
really surprisingly fast.  The thing which slows it down the most is eval-ing
the prompt after each command (so you can have the command number or the
date or current directory in your prompt) -- if this bit of code is removed,
you are not particularly aware your commands are being pre-processed.  I will
include a summary of the commands (still got to write the manual page *sigh*)
at the end of this article -- if enough folks are interested, I'll post it,
otherwise I'll be happy to mail it out.
--chris
:
:	Bcsh -- A Simple Cshell-Like Command Pre-Processor For The Bourne Shell
:
:	"Copyright (c) Chris Robertson, December 1985"
:
:	This software may be used for any purpose provided the original
:	copyright notice and this notice are affixed thereto.  No warranties of
:	any kind whatsoever are provided with this software, and it is hereby
:	understood that the author is not liable for any damagages arising
:	from the use of this software.
:
:	To the best of my knowledge this should work on ANY Bourne shell --
:	except that if your shell does not understand 'echo -n' you will have to
:	change the 6 or so places where this occurs.
:
:	Features:
:
:	+  simple command history
:	+  command history persists across bcsh sessions
: "	+  last-command editing via ^string1^string2 syntax or via 	"
:	   EDITOR or VISUAL editors -- defaults are 'ed' and 'vi'
:	+  aliases
:	+  sources .bcshrc on startup if present
:	+  history file name, .bcshrc file name, alias file name,
:	   number of commands seen via history command, number of commands
:	   saved on termination, etc. settable via environment variables
:	+  prompt may show current directory, command number, date, etc.
:
:	Commands:
:
:	CMND			run the Unix command CMND
:	!!			run last command+
:	!STRING			run most-recent command from history list
:				beginning with STRING -- may have extra
:				arguments at end of command
:	?STRING			run most-recent command from history list
:				containing STRING -- may have extra arguments
:				at end of command
:	!NUMBER			run command NUMBER from the history list
:				-- may have extra arguments at end of command
: "	^string1^string2^	substitute string2 for string1 in last command"
:				command and run it
:	~e			edit last command using $EDITOR
:	~v			edit last command using $VISUAL
:	logout
:	exit
:	bye			write out history file and exit+
:	h
:	history			show current history list+
:	alias NAME CMD		create an alias called NAME to run CMD
:	unalias NAME		remove the alias NAME
:	
:	commands marked with '+' are not added to the history list
:
:	In addition, the conventions of '!!:n', '!!:$', and '!!:*',
:	meaning the nth element of the previous command, the last
:	element of the previous command, and all the previous command
:	except the command name itself, are supported.
:
:	None of the colon extensions of the cshell are supported.
:
:	Shell Variables:
:
:	EDITOR		editor used by ~e command, default "ed"
:	VISUAL		editor used by ~v command, default "vi"
:	MAIL		your system mailbox
:	CHECKMAIL	interval in seconds between mail checks, default = 120
:	PAGER		paging program used by history command, default = "more"
:	history		number of commands in history list, default = 22
:	histfile	file history list is saved in, default = $HOME/.bhistory
:	savehist	number of commands remembered from last bcsh session
:	aliasfile	file of aliased commands, default = $HOME/.baliases
:
-- 

Christine Robertson  {linus, ihnp4, decvax}!utzoo!globetek!chris

Money may not buy happiness, but misery in luxury has its compensations...



More information about the Comp.sources.unix mailing list