Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For tcsh, I have a prompt that is multiline:

set prompt = "%/\\
%n@%m[%h]% "

This shows the cwd on one line and then the user/host on second line. However, with this, I cannot make a copy of that:

setenv X "$prompt"
Unmatched ".

The reason this is an issue for me, is that when I use virtualenv to create virtual environment for Python, it will automatically create an "activate" script, which as part of the script, it saves the current prompt and alters it to include virtual environment info. The prompt is restored, when the "deactivate" script is invoked.

Is there a way to assign a multiline variable to another?

I'm thinking I need to just give up on the multiline prompt, because I think I'll have problems, once the activate script is invoked, as I have aliases for updating the prompt (I got this a long time ago from someone). From my .cshrc file:

alias set_prompt 'set prompt = "%/\\
%n@%m[%h]% "'

alias cd 'cd \!*; set_prompt'


Is there any better way to do this, so that the prompt is updated when moving, but I can also use the activate script to alter the prompt? Here is a fragment from the automatically generated activate script for reference:

set _OLD_VIRTUAL_PROMPT="$prompt"

if ("" != "") then
    set env_name = ""
    if (`basename "$VIRTUAL_ENV"` == "__") then
        # special case for Aspen magic directories
        # see http://www.zetadev.com/software/aspen/
        set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
        set env_name = `basename "$VIRTUAL_ENV"`
set prompt = "[$env_name] $prompt"


share|improve this question
Solved: Embarrassingly, at work someone suggested to use \n instead of \\ and multiple lines, thereby avoiding the problem. – pcm Aug 31 '12 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.