[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] getting bash sh to read in personal config

From: Bob Proulx
Subject: Re: [Help-bash] getting bash sh to read in personal config
Date: Wed, 28 Oct 2015 13:33:37 -0600
User-agent: Mutt/1.5.24 (2015-08-30)

David Niklas wrote:
> Bob Proulx wrote:
> > On your system /bin/sh may or may not be bash.  On many systems it is
> > linked to dash.  If it is dash or other then it won't run any bash
> > specific environment script.
> My intelligence feels insulted. Isn't it common knowledge that sh is
> symbolicly linked to something else?
> ls -l `which sh`
> lrwxrwxrwx 1 root root 4 Sep 19 16:08 /bin/sh -> bash

There was no intention for insult.  The discussion from me was all
very factual.

Since you didn't say I couldn't assume.  The only information to go
upon is what you wrote.  If you don't provide the information then we
(*I*) can only make general guesses.  That is why I said it "may or
may not be".  Because it is exactly that literally.  It may or may not
be bash.  If you were to read the mailing lists you will find that
many people do not know this.

On Debian and Ubuntu based systems /bin/sh isn't symlink'd to bash.
(Not anymore.  It changed.)  On *BSD systems it isn't either.  And
neither is it on HP-UX.  And the list goes on and on.  How are we to
know what your system is or is not?  You would need to eat more fish
so that your power of telepathy is stronger! :-)

  $ ls -l /bin/sh
  lrwxrwxrwx 1 root root 4 Nov  8  2014 /bin/sh -> dash

And even on systems where /bin/sh is symlink'd to bash when invoked as
"sh" then bash will set POSIX mode and for compatibility will behave
more like a POSIX standard shell than a bash shell.

> > Eww...  Putting that into /etc/profile polutes everyone's
> > environment.  Not good.
> Only for those with an .profile file in their home dir,

Huh?  What?  Huh?  The above appears to say that /etc/profile is only
read if ~/.profile exists?  Sorry but no that is not correct.

The "INVOCATION" section of the bash manual covers this topic in
detail.  It is somewhat involved.  If you have questions the mailing
list here would be happy to discuss and clarify it.

> and I'm the only user on my system, so I don't think it is a
> problem.

Sure.  It is your system and if you are the only user then there is
more flexibility in the solution space.  Do anything you want. :-)

I only worry that other people coming along later and reading the
mailing list and the mailing list archives might blindly follow this
solution without fully understanding all of the ramifications and make
rather a mess of things.  Therefore I commented that it isn't a good
thing to do.  Because sorry but it isn't.

Putting those kinds of personal taste customizations into the global
config is mixing up the layering.  It won't hurt me if you do it on
your personal machine.  But if someone thinks that is the correct
layer to insert personal customizations then that tends to creep into
the wild in other places and that tends to come around and hurt me.

> Even if I were on a multi-user system, I could mention it to
> everyone and take a vote, most people that I've heard of that use
> Linux don't have a ~/.profile file.

I stood up virtually in my work area and took a survey on one small
work group system.

  # ll /home/*/.profile | wc -l
  # ll /home/*/.bash_profile | wc -l
  # ll /home/*/.bashrc | wc -l
  # ll -d /home/* | wc -l
  # ll /home/*/.kshrc | wc -l
  ls: cannot access /home/*/.kshrc: No such file or directory
  # ll /home/*/.login | wc -l
  ls: cannot access /home/*/.login: No such file or directory

And on a different small work group system.

  # ll /home/*/.profile | wc -l
  # ll /home/*/.bash_profile | wc -l
  ls: cannot access /home/*/.bash_profile: No such file or directory
  # ll -d /home/* | wc -l

Of course these types of surveys are useless.

> > I suggest using X resources with different names.
> I thought of that, but wanted something more general.

Huh?  What?  Huh?  But X resources are extremely general.  That is
what they were designed for.  IMNHO using them would be a very general
solution.  Which is why I suggested it.

However if you don't like it that is fine.  Do your own thing.

> I also have not sought out the knowledge on how to tell what is
> called what by X window.

If you don't like X resources then the suggestion by Greg to use shell
wrapper scripts customized for what you want is another good solution.

Please remember that you wrote to the community and asked for advice
and suggestions.  Don't be surprised that a variety of people with
different backgrounds will have different suggestions!  We all have a
unique background and will like what we like and make different
suggestions.  This is a good thing because it allows different points
of view to be discussed.  We all learn something.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]