Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
09-03-2014, 05:48 AM
|
#16
|
Member
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 722
Rep:
|
This is my root's .bashrc
Of course, my user .bashrc is much more comprehensive
Code:
#!/bin/bash
xhost +local:root > /dev/null
. /etc/profile
|
|
|
09-03-2014, 06:06 AM
|
#17
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,773
|
can you explain that . /etc/profile ? I think that is against the original way (see man page of bash, invocation)
Quote:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
...
When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.
|
|
|
|
09-03-2014, 06:17 AM
|
#18
|
LQ Veteran
Registered: May 2008
Posts: 7,014
|
Yep, running /etc/profile from bashrc is most definitely wrong.
And having xhost in there isn't really appropriate either.
|
|
|
09-03-2014, 07:05 AM
|
#19
|
Member
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 722
Rep:
|
Quote:
Originally Posted by GazL
Yep, running /etc/profile from bashrc is most definitely wrong.
And having xhost in there isn't really appropriate either.
|
This was the advice I once received in this forum when I was running terminal, su-ing up and then running thunar (as root). Before adding xhost to .bashrc, I couldn't get the thunar icons.
Several hundred posts have passed since then so it will take me a while to track down which culprit gave me that advice.
ETA I found where the xhost advice came from: http://www.linuxquestions.org/questi...8/#post4302571
Where the /etc/profile came from I don't remember - but it works so I am not in a hurry to fix it.
Last edited by psionl0; 09-03-2014 at 07:19 AM.
|
|
1 members found this post helpful.
|
09-03-2014, 08:00 AM
|
#20
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552
|
in my user .bashrc, I like to add a timeout (in sec) for ssh connection
Code:
# ssh timeout
if [ ! -z "$SSH_CONNECTION" ]; then
export TMOUT=600
fi
|
|
|
09-03-2014, 11:50 AM
|
#21
|
Member
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
|
Mines quite boring, mostly colour related stuff.
I don't tend to do alot as root.
Code:
#colours
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background
bakred='\e[41m' # Red
bakgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
bakblu='\e[44m' # Blue
bakpur='\e[45m' # Purple
bakcyn='\e[46m' # Cyan
bakwht='\e[47m' # White
txtrst='\e[0m' # Text Reset
#variables
export PS1="\n\[$txtwht\][\[$bldgrn\]\u\[$txtwht\]][\l]\[$txtrst\]\[$bldwht\]>>\[$bldwht\][\[$txtgrn\]\h\[$txtwht\]|\[$bldblk\]\[$bldcyn\]\w\[$bldwht\]]\[$txtrst\]\n\[$bldgrn\]\$ \[$txtrst\]"
export EDITOR=nano
export PAGER=most
#aliases
alias ls="ls --color=auto"
alias grep="grep --color=auto"
case $TERM in
rxvt|*term)
PROMPT_COMMAND='echo -ne "\033]0;$PWD\007"'
;;
esac
#shell commands
echo "!! GOD MODE ACTIVATED !! ..."
|
|
|
09-03-2014, 12:26 PM
|
#22
|
Senior Member
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223
Rep:
|
Quote:
Originally Posted by psionl0
This was the advice I once received in this forum when I was running terminal, su-ing up and then running thunar (as root). Before adding xhost to .bashrc, I couldn't get the thunar icons.
Several hundred posts have passed since then so it will take me a while to track down which culprit gave me that advice.
ETA I found where the xhost advice came from: http://www.linuxquestions.org/questi...8/#post4302571
Where the /etc/profile came from I don't remember - but it works so I am not in a hurry to fix it.
|
I am following BLFS approach for this and it seems good: login shell calls /etc/profile with system wide variables and calls /etc/bashrc with system wide aliases, ~/.bash_profile for custom environment variables and same thing goes for ~/.bashrc.
Like this
|
|
|
09-04-2014, 07:57 AM
|
#23
|
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,307
Rep:
|
Found this site where you can try out PS1 settings:
http://bashrcgenerator.com/
|
|
2 members found this post helpful.
|
09-09-2014, 10:43 AM
|
#24
|
Member
Registered: Mar 2007
Location: Whitsett,NC
Distribution: Slackware 14.1 and MINT 17.1
Posts: 105
Original Poster
Rep:
|
Thanks everyone
I thought this was great. I am still taking notes and getting ideas.
|
|
|
All times are GMT -5. The time now is 07:10 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|