Changing the prompt in CSH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Changing the prompt in CSH
# 1  
Old 09-26-2013
Code Changing the prompt in CSH

Need assistance in changing prompt .

Trying to change prompt in csh,tcsh shell . Below are the commands i tried in .cshrc and sourcing this files.

Code:
set prompt = "$user@`uname -n` : ${cwd}> "

#above commands works for username and hostname but cwd doesnt change
directories

Code:
set prompt = "$user@`uname -n` : ${cwd}> "

Code:
set prompt  = '%B%m%b %c3 %# '

#this isnt working either

Any ideas appreciated . Thank you
# 2  
Old 09-26-2013
Code:
set prompt = `hostname | awk -F. '{print $1}'`"$PWD>


Last edited by blackrageous; 09-26-2013 at 06:28 PM..
# 3  
Old 09-26-2013
Putting $CWD in backticks won't stop $CWD from evaluating before the prompt is ever shown. Try \$ if csh lets you do that
# 4  
Old 09-26-2013
No luck Smilie
# 5  
Old 09-26-2013
Code:
set prompt  = '%B%m%b %c3 %# '

Does seem to work (tested in CSH on OS X and on CentOS).

What OS are you using, and what does not work about it?
# 6  
Old 09-26-2013
SunOS <servername> 5.10 Generic_127111-09 sun4u sparc SUNW,SPARC-Enterprise

the above commands doesnt change to username,hostname.

After setting the path i get the same result

Code:
%B%m%b %c3 %#

---------- Post updated at 02:04 PM ---------- Previous update was at 01:33 PM ----------

Appreciate if someone can help me on this !!!!
# 7  
Old 09-26-2013
The best help I can give you is...

Don't use C-Shell. This is 2013, not 1983 Smilie
This User Gave Thanks to Scott For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing script from csh to bash

Hello Guys I have a script working fine on csh, but I would like to change it to bash, how I should change this command to be able to work as bash script. :wall: if ( $fsw > "0" ) then foreach swath ( `awk 'BEGIN {for (i='$fsw';i<='$lsw';i++) printf ("%s\n", i) }'` ) ## work to be done... (2 Replies)
Discussion started by: jiam912
2 Replies

2. UNIX for Dummies Questions & Answers

Problem in C shell (csh) prompt setting containing the '$' char

Hi, I am trying to customize the command prompt of the C shell as follows: set prompt=" " The above one works fine but when I try to add a '$' (dollar) symbol into the string as set prompt=" " I am getting the error as: Illegal variable name However, this one set prompt = "-- %T %n %~ --... (2 Replies)
Discussion started by: royalibrahim
2 Replies

3. Shell Programming and Scripting

Changing the file name to a different one using csh

I have a file name n10-z30-dsr65-ndelt1.00-varp0.08-16x12drw-csq-msf.ps and I want to remove the varp info tag to get n10-z30-dsr65-ndelt1.00-16x12drw-csq-msf.ps Trying to use tr, but when I tried replacing varp with ooo I am getting the results below: echo... (2 Replies)
Discussion started by: kristinu
2 Replies

4. Shell Programming and Scripting

Changing the shell prompt

Hi, I want to change the shell prompt, using the cd command. I have a shell prompt like this - p78-mfx(dgaw1078/9781)$ Now i do this - p78-mfx(dgaw1078/9781)$ cd log4j here the shell prompt should change like this - p78-mfx(dgaw1078/9781)log4j$ (6 Replies)
Discussion started by: arunkumarmc
6 Replies

5. 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

6. UNIX for Advanced & Expert Users

Changing the password prompt

Is there any way I can change the prompt which asks for the password on a UNIX system? e.g. When I login using Telnet instead of "Password" I should get "Correct Password". Thanks, Vineet (3 Replies)
Discussion started by: vineetd
3 Replies

7. Solaris

Changing prompt

I currently have this as my prompt when I log in (shell is sh): PS1="`hostname ` # " My question is how do I add the current directory to that prompt? Is there a way? Thanks. (5 Replies)
Discussion started by: kjbaumann
5 Replies

8. UNIX for Dummies Questions & Answers

Changing Prompt in sh

I know no one has ever asked this before {not :D } but I am trying to set the prompt in the .profile under sh. I have tried everything I have seen on the web in regards to this, with no success. The OS is SCO Unixware 7.1.1, {not by my choice}. All the examples I see seem to be for ksh, which is... (1 Reply)
Discussion started by: jcc5169
1 Replies

9. UNIX for Dummies Questions & Answers

Changing the prompt

Phew simple question, I want to display the my directory path in prompt. Did the following in .profile PS1=`pwd` export PS! Worked, but it always points to HOME directory. When i do a cd, it doesn't change. What am i missing. Thanks (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

10. Shell Programming and Scripting

current directory as part of the csh prompt

I would like my csh prompt to behave like the linux csh prompt setting done by linux command (set prompt="%n@%m %c]$ ") how do I do that? What I'm trying to do is that I would like to see what directory I'm in by looking at the prompt. I've figured out that %n is like $user, and %m is like... (3 Replies)
Discussion started by: jamesloh
3 Replies
Login or Register to Ask a Question