Subject: Shrc operator error or is this a bug?
To: None <Netbsd-users@netbsd.org>
From: Glen Johnson <gjohnson@valcom.com>
List: netbsd-users
Date: 10/09/2007 10:07:08
NetBSD-users,
I am trying to define an alias in my ~/.shrc file.  The first alias
defined in my ~/.shrc does not work properly.  I found that if I added
an extra line inside /etc/shrc that seemed to fix things.  I am thinking
that I have done something wrong,  however since this is NetBSD 4.0RC2 I
wanted to verify with those of you who have a deeper understanding of
/etc/shrc, ~/.shrc and how the interact.
When _THIS_FIX is defined the alias junk works.  When _THIS_FIX is NOT
defined then junk still shows up in the alias list but when I invoke it
I get, "junk: not found".

Below are listed my /etc/shrc and ~/.shrc files, (in that order).
-----------------------------------------------------------------
/etc/shrc:
ll(){ ls -l ${1+"$@"}; }

case "$-" in *i*)
        HOST="$(hostname)"   # I added this because HOST wasn't being set.
        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

        ## FIX_ME
        # Why does adding this line below fix my ~/.shrc?  If the
        # following line is not included the first alias that I set
        # in  .shrc does not work.
        export _THIS_FIX='Why does this fix ~/.shrc aliases?'
        ;;
esac
-----------------------------------------------------------------
~/.shrc:
#       $NetBSD: dot.shrc,v 1.2 2006/09/14 13:01:32 pavel Exp $

. /etc/shrc

case "$-" in *i*)
        # interactive mode settings go here
        alias junk='ls -lh'
        alias lh='ls -lh'
        alias la='ls -a'
        alias lf='ls -F'
        ;;
esac
-----------------------------------------------------------------