shell (tcsh) prompt gets reset on every cd


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers shell (tcsh) prompt gets reset on every cd
# 1  
Old 11-11-2010
shell (tcsh) prompt gets reset on every cd

Hi,

I type in my shell:
set prompt="(%M) %c%b%# "

to get something like:
a/b/c>

this works, but only partially.
every time I move to to a different directory (i.e. 'cd <some dir>'), the prompt is reset. Meaning, when I 'echo $prompt' after setting the prompt I get the correct prompt, but right after that when I cd to a different dir, 'echo $prompt' returns blank.

of course the prompt itself doesn't show 'a/b/c>' anymore.

what can be cause this?
thank you

Last edited by yuvalbn; 11-11-2010 at 05:12 AM.. Reason: typo
# 2  
Old 11-11-2010
Arent you talKing DOS here? It seems to me... and so wrong forum

A prompt in unix could be PS1 (PS2 etc...) environment variable and set normally by default at login either in /etc/profile (for all users...) or in your .profile...
# 3  
Old 11-11-2010
no, this isn't DOS, it's tcsh.
let me clarify.

I have the 'set prompt' command in my ~/.cshrc which runs at login.
for some reason this isn't working, as I detailed in my previous post.
to check what happens to the prompt, i just typed the 'set prompt' command in my shell and saw my prompt changes accordingly, but when i change dir the prompt is reset to showing only one level of directories (and not 3 as i wanted). this is probably what causing the default settings from ~/.cshrc not to work.
what can dynamically change $prompt like that?

p.s.
i don't have $PS1 set in my shell by default
# 4  
Old 11-11-2010
15 years since last time I used tcsh... excuse my lack of memory....
and yes you are right its prompt in .cshrc and no PS1 (sh / ksh...), I will see if I can find in my old notes ( will be hard to find though... 15 years...) anything...


All the best


What are you trying to achieve for a prompt display?
I dont undestand the issue.. could you give a sample of what your prompt display, lest say when you are in your home directory, then go to /usr/local/bin and give us the new prompt and explain what you want, thanks

Last edited by vbe; 11-11-2010 at 10:24 AM.. Reason: rm obsolete csh syntax...
# 5  
Old 11-11-2010
in /usr/local/bin, the prompt is now:
(bin)

I would like it to be:
/usr/local/bin>
# 6  
Old 11-11-2010
been awhile for me too... try:
Code:
set prompt='%s%B%m:%b [%B%T%b] [%h] %~%#'

# 7  
Old 11-11-2010
What does this give you?

set prompt = "%B%m%b [%/] "
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tcsh Shell trouble

Need assistance in getting a solution for a TCSH shell environment variable . I read on internet that leading zeros as octal numbers and redhat doesnt supports octals but Solaris works on TCSH shell. Is there any way we can fix this . All my script has 08 or 09 $ @ x = 5 + 08 @: Badly formed... (8 Replies)
Discussion started by: ajayram_arya
8 Replies

2. Shell Programming and Scripting

Specifying a tcsh shell using winbind

The campus system that I use has switched to using winbind. In the old days, I was able to specify tcsh as my shell with the usual entry in /etc/passwd. But I'm told winbind doesn't have user specific entries, and now my ssh login defaults to a bash shell. Can anybody advise how I can... (2 Replies)
Discussion started by: LeoKSimon
2 Replies

3. Shell Programming and Scripting

how to prompt the user to enter an array in tcsh

Hello, I am writing a script that requires the user to enter a string of numbers: ex: 134 345 865 903 This command only allows for one variable to be entered: set "var" = $< and than once I got the array I want to change it to a list with each input on a different line: ... (1 Reply)
Discussion started by: smarones
1 Replies

4. UNIX for Dummies Questions & Answers

issue with my prompt on tcsh

Hi, issue with my prompt, other gets their name, my comes with command number. Why? {118} /home/markb > echo $SHELL /bin/tcsh {119} /home/markb > echo $SHELL /bin/tcsh {120} /home/markb > my .cshrc has this.... set prompt="%{\0330;%n@%M : %~%L \007%} `pwd` >%{\033 ... (3 Replies)
Discussion started by: samnyc
3 Replies

5. UNIX for Dummies Questions & Answers

scp not working because of prompt (AIX, tcsh)

Hello, I have this problem: I have a server to which I ssh, and it has a special prompt request. The prompt is done by a ?prompt command. It is fine with SSH, since the prompt I guess gets some input, but when I use SCP, the copy always fails. So, I was wondering if there is maybe a... (1 Reply)
Discussion started by: lastZenMaster
1 Replies

6. HP-UX

How to find tcsh shell version info in HP-UX?

Hi, I need to find tcsh shell version info on several boxes. I made a script and running on boxes through SSH. This is what i am doing : echo /bin/tcsh -c 'echo $version' | ssh "box name" but i dont see anything. if i run /bin/tcsh -c 'echo $version' on ocal machine i see the... (2 Replies)
Discussion started by: kailash19
2 Replies

7. Shell Programming and Scripting

tcsh/csh: set prompt in production to color red

Hi folks This is our prompt at the moment oracle@pinkipinki:/opt/oracle> grep 'set prompt' .cshrc set prompt = "$user@`uname -n`:$cwd> " We wish to have in production the same prompt, but red. Howto do that? I tried a lot a internet manuals, but it doesn't work. (1 Reply)
Discussion started by: slashdotweenie
1 Replies

8. UNIX for Dummies Questions & Answers

Reset prompt back to "-bash-3.00$"

Can anyone tell me how to reset the command prompt back to the original 'bas'h prompt as these have all been changed via the /etc/profile to add username and hostname but some are too long. I just want to run it in a local .profile to put it back. Thanks (2 Replies)
Discussion started by: skewbie
2 Replies

9. UNIX for Dummies Questions & Answers

About tcsh shell

Hello, Why tcsh shell is not recommended ? then which one is better ? Also can you please let me know how to change own shell and config file? (3 Replies)
Discussion started by: darshakraut
3 Replies

10. UNIX for Dummies Questions & Answers

How to reset the unix prompt?

Hi All, How to change the UNIX prompt to the default one, after i changed it using PS1? Thanx and Regards, Saneesh Joseph. (7 Replies)
Discussion started by: saneeshjose
7 Replies
Login or Register to Ask a Question