LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-18-2014, 03:28 PM   #1
endfx
Member
 
Registered: May 2003
Location: Canada
Distribution: Debian
Posts: 105

Rep: Reputation: 15
Custom system wide PS1 not working.


I'm trying to setup a custom PS1 variable that I want to work for all users (so every user doesn't have to change their ~/.bashrc)

- When I customize the PS1 variable in /etc/bash.bashrc it doesn't seem to work.
- When I customize the PS1 variable in ~/.bashrc then it seems to work for that particular user.

Does anybody know why I can't get this to work by changing PS1 in /etc/bash.bashrc?

Thanks.
 
Old 12-18-2014, 05:46 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,129

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
I beleive that the /etc/bashrc is only used if there isn't a ~/.bashrc, if you want to use the global stuff in /etc/bashrc you have to include it like so
Code:
#!/bin/bash

if [ -e /etc/bashrc ];then
    . /etc/bashrc
fi
As the first bit of ~/.bashrc
 
Old 12-18-2014, 09:48 PM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
how you tried to make it work is more important, care.. telling us that ?
 
Old 12-18-2014, 10:05 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,257
Blog Entries: 24

Rep: Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193
/etc/bash.bashrc is NOT automatically sourced when a user logs in.

See man bash, INVOCATION section.

Typically a global file will be sourced from the user's ~/.bashrc, something like this, adjust to your use...

Code:
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
Yea, like Keith_Hedger says... (did I not see his post?!)

Last edited by astrogeek; 12-18-2014 at 10:10 PM. Reason: Brain glitch or dyslexia, credit where due...
 
  


Reply


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
Rarely used PS1 attributes - not working cryingthug Programming 7 06-20-2012 06:11 AM
[SOLVED] Ksh93 vs. Pdksh88: Custom PS1 prompt not working kristo5747 Linux - Newbie 1 01-19-2011 11:55 AM
Setting a Custom PS1 For Users? carlosinfl Red Hat 4 09-11-2010 10:11 AM
Custom PS1 For New Users? carlosinfl Debian 6 07-30-2010 02:37 PM
\$ in Bash's PS1 not working for root SlowCoder Linux - General 3 05-28-2008 12:06 PM

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

All times are GMT -5. The time now is 06:38 AM.

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