Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #8  
Old 12-01-2009
ahmad.diab's Avatar
Registered User
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 537
Thanks: 0
Thanked 1 Time in 1 Post
Is the below files exist in the below condition or not , and is it /etc/bashrc or /etc/.bashrc

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

and if exist kindly submit cat /etc/bashrc

Sponsored Links
  #9  
Old 12-01-2009
pupp's Avatar
pupp pupp is offline Forum Advisor  
cap_10hdx 1
 

Join Date: Feb 2008
Location: Jersey Shore
Posts: 647
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.
therefore, edit your .bash_profile to call .bashrc and you will always execute .bashrc from any "style" of login.
  #10  
Old 12-01-2009
admax's Avatar
Registered User
 

Join Date: Oct 2009
Location: Bangalore / India
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Dear scottn

I checked .bash_profile it is not set.
this is my .bash_profile

...........................................................................
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
.............................................................................

still i have the same prompt

---------- Post updated at 08:25 PM ---------- Previous update was at 08:22 PM ----------

Quote:
Originally Posted by ahmad.diab View Post
Is the below files exist in the below condition or not , and is it /etc/bashrc or /etc/.bashrc

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

and if exist kindly submit cat /etc/bashrc


does not exists.
  #11  
Old 12-01-2009
scottn's Avatar
scottn scottn is online now Forum Staff  
Moderator
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 2,593
Thanks: 13
Thanked 91 Times in 88 Posts
Try putting the PS1=... at the end of your .bashrc script?
  #12  
Old 12-01-2009
admax's Avatar
Registered User
 

Join Date: Oct 2009
Location: Bangalore / India
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
I got it.

Thanks to all of u.

i commented few lines in bashrc now i am getting my desired prompt.

----------------------------------------------------------------------------------------------------
#if [ -f /etc/bashrc ]; then
# . /etc/bashrc
#fi
#if [ -f /etc/bash.bashrc ]; then
# . /etc/bash.bashrc
#fi
----------------------------------------------------------------------------------------------------

But still i have a question

What is the need of bashrc in /etc/ ?
means what is the role ?
  #13  
Old 12-01-2009
ahmad.diab's Avatar
Registered User
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 537
Thanks: 0
Thanked 1 Time in 1 Post
you are using the file /etc/.bashrc not the one in your home as the ~/.bashrc is saying

and I asked you if /etc/.bashrc is exist or not and I didn't get the answer yet
(kindly note the "." before the word bashrc)

your ~/.bashrc is excuting the code /etc/.bashrc when you login.(not good)

when your ~/.bashrc is removed you need to modify your ".bash.profile" in a way that is to use the /etc/.bashrc when you lose your ~/.bashrc (somehow) kindly see below:-



Code:
add this condition to your .bashrc.profile and remove it from your ~/.bashrc:-

if [ -f $HOME/.bashrc ]; then
 . $HOME/.bashrc
else
. /etc/.bashrc
fi

  #14  
Old 12-01-2009
admax's Avatar
Registered User
 

Join Date: Oct 2009
Location: Bangalore / India
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
thanks ahmad.diab.

I made modifications in my .bash_profile.

Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Where to change the UNIX password prompt? DrivesMeCrazy UNIX for Dummies Questions & Answers 0 05-05-2009 04:12 AM
Change root prompt (Solaris) RobertSubnet UNIX for Dummies Questions & Answers 10 01-02-2009 04:00 PM
How to change prompt drogram UNIX for Dummies Questions & Answers 4 04-28-2008 11:48 AM
customize my prompt in bash yankee428 UNIX for Dummies Questions & Answers 2 06-23-2005 02:02 PM
script to change shell and prompt SHYAM Shell Programming and Scripting 1 06-27-2004 08:46 AM



All times are GMT -4. The time now is 07:31 AM.