LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 11-15-2009, 02:49 AM   #1
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Rep: Reputation: 0
Changing prompt in tcsh


Hi,
I am trying to change the propmpt in tcsh in Redhat.
I did all the following:
In ~/.cshrc I added at the end of the file the new prompt.
Copied csh.cshrc and csh.login to ~/ and added the new prompt at the end of both of them.

I get the new prompt every time I open a terminal window, but the minute I am changing a directory, I get the old prompt again.
Can you tell me where else I should change the prompt?

Thanks
Guy Yafe
 
Old 11-15-2009, 01:29 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Which OS / version, exactly? ("Redhat" is not descriptive enough.)

First, check some tcsh prompt examples.

Next, read the tcsh(1) manpages for your OS / version, and confirm that ~/.cshrc is read at shell startup (as opposed to, say, ~/.tcshrc) -- and in what order.
 
Old 11-18-2009, 01:59 AM   #3
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
After printing /etc/issue
I got
Quote:
Red Hat Enterprise Linux ES release 4 (Nahant Update 2)
I couldn't find anything in the manual that could solve the problem.
I don't have ~/.tcshrc, only ~/.chrc. I tried changing the latter to .tcshrc, and also didn't work.

Guy
 
Old 11-18-2009, 05:12 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
From the tcsh(1) manpages on a RHEL4 system:
Code:
       A login shell begins by  executing  commands  from  the  system  files
       /etc/csh.cshrc  and  /etc/csh.login.   It  then executes commands from
       files in the  user’s  home  directory:  first  ~/.tcshrc  (+)  or,  if
       ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the
       histfile shell variable), then ~/.login, and  finally  ~/.cshdirs  (or
       the  value  of  the  dirsfile shell variable) (+).
If you're sure you have the file named correctly (it's misspelled in your last post), then post its contents here...
 
Old 11-22-2009, 01:46 AM   #5
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Yes, there was a typo in my post, but the files are named correctly.
Here is its contents:
Code:
set path = (/usr/kerberos/bin /bin /usr/bin /usr/local/bin /usr/bin/X11 /usr/X11R6/bin /rtsw/workbench25/gnu/3.4.4-wrlinux-1.3/x86-linux2/bin/ ./)
# global enviroment file for csh/tcsh
source /auto/tools/etc/ENV.rtsw
# END
setenv EDITOR kedit
set prompt = "%/>"
set prompt2 = ">"
Guy
 
Old 11-24-2009, 04:17 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
The first prompt assignment works OK for me:
Code:
> set prompt = "%/>"
/home/mrbig>
What if you source it in manually?
Code:
source .tcshrc
 
Old 11-25-2009, 12:18 AM   #7
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Again, it loads the configurations, but as soon as I am changing the directory (Actually I don't have to change - just write the cdcommand), I get the old prompt back.

Code:
[guyy@guyy_l ~] tcsh> source .tcshrc
/auto/others/guyy>cd ./
[guyy@guyy_l ~] tcsh>
Guy
 
Old 11-25-2009, 01:11 PM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Code:
$ grep 'guyy' /etc/passwd
?

I can't explain the behavior you're seeing.
 
Old 12-01-2009, 01:33 AM   #9
desperado
LQ Newbie
 
Registered: Jan 2008
Distribution: Fedora
Posts: 7

Rep: Reputation: 0
You must have a statement like this in ur .tcshrc file:


Code:
set prompt=<something>
add the following lines somewhere below it

Code:
alias myPrompt 'set prompt=<something>'
alias cd 'cd \!*; myPrompt'
I guess the prompt should start working properly now....
 
Old 12-02-2009, 01:18 AM   #10
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Sorry, still doesn't work

Here is my .tcshrc file:
Code:
set path = (/usr/kerberos/bin /bin /usr/bin /usr/local/bin /usr/bin/X11 /usr/X11R6/bin /rtsw/workbench25/gnu/3.4.4-wrlinux-1.3/x86-linux2/bin/ ./)
# global enviroment file for csh/tcsh
source /auto/tools/etc/ENV.rtsw
# END
setenv EDITOR kedit
set prompt = "%/>"
set prompt2 = ">"

alias myPrompt 'set prompt="%/>"'
alias cd 'cd \!*; myPrompt'
Just getting the same results.
 
Old 12-02-2009, 11:15 PM   #11
desperado
LQ Newbie
 
Registered: Jan 2008
Distribution: Fedora
Posts: 7

Rep: Reputation: 0
create a file named ".prompt" in your $HOME directory. Put in all the "set prompts" and related stuff in that file and source it in your .tcshrc

So your .prompt should have

Code:
set prompt = "%/>"
set prompt2 = ">"

alias myPrompt 'set prompt="%/>"'
alias cd 'cd \!*; myPrompt'
and .tcshrc should have

Code:
set path = (/usr/kerberos/bin /bin /usr/bin /usr/local/bin /usr/bin/X11 /usr/X11R6/bin /rtsw/workbench25/gnu/3.4.4-wrlinux-1.3/x86-linux2/bin/ ./)
# global enviroment file for csh/tcsh
source /auto/tools/etc/ENV.rtsw
# END
setenv EDITOR kedit
source-r ~/.prompt
hopefully it'll work now.
 
Old 12-06-2009, 02:39 AM   #12
guyafe
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Nope.
Again - getting the same behaviour.
I am starting to think that it is related to some strange user privileges, my sys-admin configured (He himself has no idea about how to solve this problem).
I have never seen this before, I didn't have this problem on any other platform - Ubuntu, Kubuntu, OpenSuse, and even Red Hat in another places.
Anyway, thanks a lot for all of your help.
 
Old 12-06-2009, 12:04 PM   #13
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Is it possible that you have prompt config file somewhere in the PATH? Like did you backup one of those files to /etc folder for example? Maybe your prompt change gets overridden by rouge config file.
 
Old 12-15-2010, 02:58 AM   #14
haltki
LQ Newbie
 
Registered: Dec 2010
Posts: 1

Rep: Reputation: 0
I had the same problem, and desperado's solution worked for me. In the .tcshrc, add this:

set prompt=<something>
alias cd 'cd \!*; set prompt=<something>'
 
  


Reply



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
Changing the prompt? Ordinary12 Fedora 14 05-23-2007 10:05 PM
tcsh prompt with colors TroelsSmit Linux - Newbie 2 12-20-2004 07:55 AM
changing text colors in tcsh shell leontini Linux - General 1 08-17-2004 02:53 AM
Changing the BASH Prompt Blade_Powers Linux - Newbie 4 03-28-2004 09:21 PM
How to set tcsh prompt: # for root and % for user? robson Linux - Newbie 1 10-12-2003 03:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 08:24 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