[BACK]Return to .etshrc CVS log [TXT][DIR] Up to [cvs] / v6shell / examples

File: [cvs] / v6shell / examples / .etshrc (download)

Revision 1.5, Sat Dec 15 21:22:04 2018 UTC (4 weeks, 4 days ago) by jneitzel
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +4 -4 lines

Update examples/{.*,*}; primarily, 'io' to 'nl' changes...; + in
examples/.etshrc, remove the fd2(1) rdirection to /dev/null from
the V & VV aliases

: $h/.@EBN@rc - " Modify to taste. "
:
: "  The author of this file, J.A. Neitzel <jan (at) etsh (dot) nl>,  "
: "  hereby grants it to the public domain.                           "
:
: "  From:  https://etsh.nl/examples  "
:

: fd2 -e echo "debug: Executing `"$h/.@EBN@rc"' now..."

:
: " Make getopt(3) in the fd2 utility behave the same on  "
: " GNU/Linux systems as it does on *BSD & other systems. "
:
: setenv	POSIXLY_CORRECT	''

setenv	EDITOR		'/bin/ed -p:'
setenv	VISUAL		/usr/local/bin/nvi
setenv	PAGER		'less -is'
setenv	LESS		-M
setenv	EXECSHELL	@BINDIR@/@EBN@
setenv	LC_ALL		C

printenv TERM | grep '^vt220$' >/dev/null
if $? -eq 0 goto Continue
    printenv TERM | grep '^vt100$' >/dev/null
    if $? = 0 goto Continue

	: " Set LC_ALL and so forth according to LANG. "
	unset L
	if ! { printenv LANG >/dev/null } goto lang-unset
	printenv LANG | grep '^es_MX' >/dev/null
	if $? -eq 0 goto L-Jump
	: lang-unset
		set L en_US
		goto L-Break
	: L-Jump
		set L es_MX
		: fallthrough
	: L-Break
	: " ready; set LC_ALL and so forth below... "

	:
	: " The terminal I normally use is rxvt-unicode (urxvt),  "
	: " but I also use others on occasion.  Normally, they're "
	: " UTF-8 capable, but that's not always true.            "
	:
	setenv	LC_ALL		$L.UTF-8
	setenv	LESSCHARSET	utf-8
	printf	"%b"		'\033]701;'$L'.UTF-8\007' >/dev/tty
	unset L
	: fallthrough

: Continue - " Continue as normal. "

	source	SetV
	source	SetTandCTTY
	setenv	TTY	$t
	( stty altwerase imaxbel -oxtabs ; stty status '^T' ) <-
	xtitle

	:
	: " If the following prompt intro info is too noisy for you, feel free "
	: " to change the ... set a '' ... line below to ... set a ': ' ... to "
	: " make it quiet if you would like to do so.                          "
	:
	set a ''
	:
	$afd2 -e echo
	$afd2 -e echo "Running `( prompt ) >/dev/null' now."
	( prompt ) >/dev/null
	$afd2 -e echo \$\? -eq $?\;
	( prompt ) >/dev/null
	$aif $? -eq 1 head -5 ; goto head_exit

	When etsh starts, `prompt' & its `debug' state are both `off' by
	default.  In this case, etsh uses one of the default prompts,
	either `% ' for a regular user or `# ' for the superuser.

	: head_exit
	if ! -r $h/.etsh.prompt goto .etsh.prompt-error
		prompt on ; $aprompt
		$afd2 -e echo \$\? -eq $?\;
		$aecho
		$aecho "	`prompt' is `on' for this etsh instance; it  "
		$aecho "	will `. \$h/.etsh.prompt' automatically now. "
		goto .etsh.prompt-done
	: .etsh.prompt-error
		if ! -e $h/.etsh.prompt\
			if { fd2 -e echo "$h/.etsh.prompt: not found" }\
				goto .etsh.prompt-done
		fd2 -e echo "$h/.etsh.prompt: cannot open"
		: fallthrough
	: .etsh.prompt-done
		unset a

	:
	: " Set some useful aliases.                           "
	: " If you want an alias to ignore arguments, doing a: "
	:
	:	alias foo ' echo foo bar baz ; : '
	:
	: " or "
	:
	:	alias foo 'echo foo bar baz;:'
	:
	: " ... "
	: " or similar (for example) is a simple way to do so. "
	: " The terminating ` ; : ' or `;:' (in effect) turns  "
	: " alias arguments into a no-op.                      "
	:
	alias	V	'@EBN@ -V ;:'
	alias	VV	'@EBN@ -VV;:'
	alias	aliases	'(alias;:)'
	alias	glob	'echo'
	alias	h	history
	alias	hcount	"setenv LC_ALL C;awk '{print \$1;}'<$h/.etsh.history|sort|uniq -c|sort -k1 -rn|head -25;:"
	alias	isset	'set'
	alias	jobs	'fd2 -e echo "@EBN@: not a job-control shell";false'
	alias	lf	'ls -F'
	alias	li	'ls -i'
	alias	ll	'ls -AlF'
	alias	loadavg	"echo -n $H': ';uptime|sed 's/^.*user[s,][ ,] *//';:"
	alias	lynx	'setenv LC_ALL C;exec lynx'
	alias	manpath	'echo $m;:'
	printenv TERM | grep '^vt220$' >/dev/null
	if $? -eq 0 goto IsVT220
		alias	n	'echo "日本語 Nihongo";:'
		alias	nihongo	'source nihongo'
		: fallthrough
	: IsVT220
	alias	now	"date '+%A, %Y-%m-%d, %T %Z';:"
	alias	ocpwd	'cd -;pwd;cd -;pwd;:'
	alias	opwd	'cd -;pwd;:'
	alias	path	'echo $p;:'
	alias	pparm	'echo $0: $#: $*;:'
	alias	psmem	'ps -Ovsz,rss -m'
	alias	sensors	'sysctl hw.sensors;:'
	alias	tshi	'trap : 1 2 3 13 14 15 18 21 22;tsh -c xtitle;(trap - 1 2 3 13 14 15;tsh);xtitle;:'
	alias	s	'echo $?;:'
	alias	status	's'
	alias	sysinfo	"echo -n '==== ';uname -n|tr -d \\n;echo ' ====';echo;uname -srm;echo;now;echo;uptime;:"
	alias	topc	'top -C;:'
	alias	unl	'uptime;now;loadavg;:'
	( alias logout ) | wc -c | tr -d ' \t' | grep '^0$' >/dev/null
	if $? != 0 goto Jump
		alias	logout	'fd2 -e echo "Not an @EBN@ login shell - Type an EOT (^D) instead";false'
		: " rmed is to remove ETSHDIR (default == /tmp/etsh-$u-$$); "
		: " typing rmed is manual, and we could forget; so, hangup  "
		: " removes $d and hangs up on $$ if HUP (1) isn't ignored. "
		alias	rmed	'if -n "$d" -a -d "$d" -a ! -h "$d" rm -rf "$d";:'
		alias	hup	'rmed;(trap)|if { grep "^trap :  1$">/dev/null } fd2 -e echo "SIGHUP ignored - Type an EOT (^D) instead";trap : 1;(trap)|if ! { grep "^trap :  1$">/dev/null } fd2 -e echo "SIGHUP ignored - Type an EOT (^D) instead";kill -HUP $$;:'
		alias	hangup	'hup'
		: fallthrough
	: Jump
		: nothing