Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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'

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 = ""
else
    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"\``
    else
        set env_name = `basename "$VIRTUAL_ENV"`
    endif
endif
set prompt = "[$env_name] $prompt"

Thanks.

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
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.