Re: RH9 breaks bash ?

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

 



In regard to: Re: RH9 breaks bash ?, Perry Hutchison said (at 1:10pm on Dec...:

>>    shopt -s xpg_echo
>
>Works on RH9 bash built-in echo, but it does not provide a single
>command form usable on all systems because the built-in echo does
>not do the right thing, with or without -e, on bash 1.14.5(1).

And you're never going to be able to solve that problem.

>Of course, the problem with not having a single common command is
>that there then needs to be a method for .bashrc to figure out
>which command form to use.

It's really not that hard.  I use the exact same .bashrc and .profile on
every single platform I have a login on, and that's dozen's of different
flavors of Linux and UNIX.

What I've taken to doing is having a "generic" .bashrc that sets things
like PATH, MANPATH, et. al. based on

	case $HOSTTYPE in

		foo*)
			...
			;;
		bar*)
			...
			;;
		baz2.7)
			...
			;;
		baz*)
			...
			;;
	esac

and then I have a section at the end of my .bashrc that does:



short_hostname=`uname -n | cut -d. -f 1`
# Since we're not consistent about case, force lower case
domain_name=`egrep 'domain|search' /etc/resolv.conf \
    | sed -n '$p' | awk '{ print $2 }' | tr '[:upper:]' '[:lower:]'`

#
# Try the FQDN one, first.
#
if  test -f $HOME/.setup/${short_hostname}.${domain_name}.bashrc || \
    test -L $HOME/.setup/${short_hostname}.${domain_name}.bashrc ; then
    . $HOME/.setup/${short_hostname}.${domain_name}.bashrc
elif    test -f $HOME/.setup/${short_hostname}.bashrc || \
        test -L $HOME/.setup/${short_hostname}.bashrc ; then
    . $HOME/.setup/${short_hostname}.bashrc
else
    # don't do anything!
    :
fi



In other words, load a host-specific .bashrc if it exists, from my
personal $HOME/.setup directory.  I also have a section that loads an
OS-specific .bashrc, so that I only need a host-specific .bashrc for
really weird hosts -- most of things can be taken care of by the main
.bashrc, with a little tweaking in the platform-specific .bashrc.

>> The current behavior goes back to [at least] RH7.0
>
>which is probably where it was introduced :(

BTW, you're aware that it's a bad idea to produce any output (your echo)
or modify any terminal settings in your .bashrc, right?  The proper place
for those things is .profile.

Tim
-- 
Tim Mooney                              mooney@xxxxxxxxxxxxxxxxxxxxxxxxx
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux