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.

On an rxvt-clone (I'm using rxvt-unicode but it seems to happen on plain, old rxvt as well), the sequence of characters %F seems to have some sort of special meaning (as do a few others, such as %S). In particular, I get the following:

% date +%F          
38;5;0m2011-04-02
% date +%F--%H.%M.%S
38;5;0m--.Hostname.2011-04-02--22.25.59

with the text after the m being in some dark almost-black colour. Due to my colour scheme (mauve text on a dark blue polka dot background), this is almost unreadable.

What is this, and more importantly, how do I get it to stop?

To show why it is particularly annoying, my lecture documents have the date as part of their name. It is therefore quite convenient to be able to write:

xelatex lecture.beamer.$(date +%F).tex

since I can store that in my history and recall it with a few judicious TABs. However, the ensuing output is all the inverse of a whiter shade of pale, making it hard to see if there's an error.

In case it makes a difference, my shell is zsh.

share|improve this question
    
Wasn't sure what to tag this, please retag as appropriate. –  Andrew Stacey Apr 2 '11 at 20:34
2  
Best question title ever. –  Adrian Petrescu Apr 2 '11 at 20:40
    
what is your shell? (not reproducing this with urxvt-unicode) –  Mat Apr 2 '11 at 20:54
    
@Mat: As I say, my shell is zsh (4.3.10), and it happens with rxvt-unicode (9.07) (I also see now that I should withdraw my claim that it happens with rxvt since on my system, rxvt is a symlink to urxvt). –  Andrew Stacey Apr 2 '11 at 21:04
    
ah sorry missed that. anything suspicious in your .zshrc? –  Mat Apr 2 '11 at 21:13
show 3 more comments

1 Answer

up vote 5 down vote accepted

In one of your comments, you mentioned using zsh with a preexec function that calls print -P $2.

In zsh, print -P accepts these format characters:

  • %F means set the foreground color
  • %S means set the standout attribute

See zsh prompt expansion for the full list.

So it's probably best to remove the -P flag from your call to print in preexec.

One way to get the same effect:

settitle() {
    printf "%b%s%b" "\033]0;" "$1" "\007"
}

tildedir() {
    print -Pn "%~" 
}

preexec() {
    settitle "$(tildedir):$2"
}
share|improve this answer
    
This looks great, thanks. I'll test it tomorrow to be sure that it works. (Now that I see your explanation of what that preexec does, I remember why I put it in and realise that I do want to keep it, so I'm particularly appreciative of this answer as it lets me do that!) –  Andrew Stacey Apr 3 '11 at 19:03
    
This works. Thanks for solving the problem. –  Andrew Stacey Apr 4 '11 at 6:56
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.