NetBSDSolveshrcIssues

Solve /etc/shrc issues

Sometimes, it seems that creating your own aliases in your local .shrc creates a conflict with the system /etc/shrc. This manifests itself in an error message such as:

ksh: /etc/shrc: 5 unexpected '('

The solution is rather simple: edit /etc/shrc and comment out the ll alias definition:

#       $NetBSD: shrc,v 1.7 2010/12/27 03:38:52 christos Exp $
#
# System-wide .shrc file for sh(1).

# ll(){ ls -l ${1+"$@"}; }

case "$-" in *i*)
	if /bin/test -z "${HOST}"; then
		HOST="$(hostname)"
	fi
	PS1="${HOST%%.*}$PS1"
	set -o emacs
	# This file is used by shells that might not support
	# set -o tabcomplete, so check before trying to use it.
	( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete
	;;
esac

You can then add your own aliases to your ~/.shrc, such as:

#	$NetBSD: dot.shrc,v 1.8 2007/11/24 11:14:41 pavel Exp $

if [ -f /etc/shrc ]; then
	. /etc/shrc
fi

hup(){ (read pid; kill -HUP $pid) </var/run/$1.pid; }

case "$-" in *i*)
	# interactive mode settings go here
	export EDITOR=/usr/pkg/bin/vim
	export PAGER=less
	export HISTSIZE=256
	# ----
	# Personal configuration
	# ----
	alias ls='colorls -GF'
	alias ll='colorls -lGF'
	alias lt='colorls -lrtGF'
	;;
esac

Everything after the "interactive mode" comment line are my own aliases, and they, of course, require colorls to be installed.

Hope this helps!