LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-03-2014, 05:48 AM   #16
psionl0
Member
 
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 722
Blog Entries: 2

Rep: Reputation: 124Reputation: 124

This is my root's .bashrc
Code:
. /etc/profile
Of course, my user .bashrc is much more comprehensive
Code:
#!/bin/bash
xhost +local:root > /dev/null
. /etc/profile
 
Old 09-03-2014, 06:06 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,773

Rep: Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565Reputation: 7565
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.
 
Old 09-03-2014, 06:17 AM   #18
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,014

Rep: Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144Reputation: 5144
Yep, running /etc/profile from bashrc is most definitely wrong.

And having xhost in there isn't really appropriate either.
 
Old 09-03-2014, 07:05 AM   #19
psionl0
Member
 
Registered: Jan 2011
Distribution: slackware_64 14.1
Posts: 722
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by GazL View Post
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.
Old 09-03-2014, 08:00 AM   #20
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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
 
Old 09-03-2014, 11:50 AM   #21
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
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 !! ..."
 
Old 09-03-2014, 12:26 PM   #22
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by psionl0 View Post
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
 
Old 09-04-2014, 07:57 AM   #23
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,307
Blog Entries: 61

Rep: Reputation: Disabled
Found this site where you can try out PS1 settings:

http://bashrcgenerator.com/
 
2 members found this post helpful.
Old 09-09-2014, 10:43 AM   #24
Gary Baker
Member
 
Registered: Mar 2007
Location: Whitsett,NC
Distribution: Slackware 14.1 and MINT 17.1
Posts: 105

Original Poster
Rep: Reputation: 3
Thumbs up Thanks everyone

I thought this was great. I am still taking notes and getting ideas.
 
  


Reply

Tags
bash scripting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Edited bashrc not sure how to fix wangcow Linux - Newbie 3 12-22-2012 04:28 PM
[SOLVED] How to use my /home/kangjoo/.bashrc rather than root/.bashrc kangjoo.lee Linux - Newbie 2 11-05-2012 03:38 PM
[SOLVED] Edited .bashrc now cannot login as root Ajit Gunge Linux - Newbie 2 06-18-2012 07:13 AM
edited the wheel group file and i cant log in as root again in the terminal cheezy86 Linux - Newbie 6 05-16-2009 07:37 PM
Problem with root file .bashrc doraimom Debian 2 11-23-2008 08:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration