problems with .bashrc

Parv parv at
Tue Apr 13 19:24:27 PDT 2004

in message <E1E23349-8D8E-11D8-BA1A-000502A8DC42 at>,
wrote fudo thusly...
> There are .profile and .shrc files in my home directory; .profile
> references .shrc with ENV=$HOME/.shrc; export ENV.

See below regarding $ENV.

> There are several uncommented alias lines in the .shrc file, but
> none of them work.  From what I've read, bash should read .profile
> and .shrc, but just

There is no mention of '.shrc' in bash(1) (2.05b.007 version here).

> in case, I tried copying them to .bash_profile and .bashrc, changing
> ENV to =$HOME/.bashrc, and renaming the original files, but the
> aliases still don't work.

Aliases /should/ work, w/o futzing w/ $ENV, as expected if listed in
.bashrc, all other things being sane.

> Aliases are formatted: alias ll='ls -laFo'; entering that at the
> prompt and it works fine. Seems like bash isn't reading the rc file.

So you tried putting debugging statements in the four files so far
mentioned, and got the output from them but aliasing consistently

> Obviously, I'm missing something; any suggestions appreciated.
> Thanks.

You have at least three options

 2. Invoke bash as sh or w/ --posix option (from bash(1)) ...

    When invoked as an interactive shell with the name sh, bash looks
    for the variable ENV, expands its value  if  it  is defined,  and
    uses the expanded value as the name of a file to read and execute.
    Since a shell invoked as sh does not attempt to read and execute
    commands from any other startup files, the --rcfile option has no
    effect.  A non-interactive shell invoked with  the name  sh  does
    not attempt  to  read  any  other  startup files.  When invoked as
    sh, bash enters posix mode after the startup files are read.

    When bash is started in posix mode, as with the  --posix command
    line option, it follows the POSIX standard for startup files.  In
    this mode, interactive shells expand the ENV variable and commands
    are  read  and executed  from  the  file whose  name is the
    expanded value.  No other startup files are read.

 1. Source the damn .shrc file w/in .profile

 0. Create .bash{_profile,rc} properly.  Read bash(1); search the
    Internet, comp.unix.{shell,misc,questions} newsgroups in
    particular, for examples, solutions/hints.

In my ~/.bashrc, file w/ alias listing is (eventually) sourced.  if
interested in my settings (skip to "Modern Bourne Shell and
Compatibles") ...


  - Parv


More information about the freebsd-questions mailing list