I'm using tsch through PuTTY, and let's start by this: please don't try to convince me to migrate to another shell...:)

It's being a long time that commands like scp and less didn't work well for me. After searching I found out, as many others, that this was because of echo commands that interrupt scp and less. I found out that moving those 'echoing commands' to the .login file instead of .cshrc or .self_schrc solved the problem.

However, there's one issue: I want to change title of the PuTTY window according to the directory I'm currently in. I managed to do so by aliasing setprompt printf "\033]0" and execute setpropmt. But then again - this printf ruins my scp and less. And this time - I can't move the execution of setprompt into .login, for certain reason.

Now, I read here and there that you can leave those 'echo commands' in the .cshrc files if you're checking for interactive shell, since less and scp won't execute lines of interactive shell.

I tried few methods, such as:

if { tty -s } then


if ($?prompt) then

but it seems that less is still 'reading' those line, and hence - giving me wrong output. What am I doing wrong here?

  • Can you move your \033]0 into $prompt instead? – Mark Plotnick Apr 7 '16 at 7:32
  • OK, I just did it, and it solved this particular problem indeed. But still - I want to know what's wrong with the previous code, just in case I encounter something I can't solve like this. – Bak Itzik Apr 7 '16 at 10:00
  • At what point, while you're running less, do you see the stray output from setprompt? – Mark Plotnick Apr 7 '16 at 14:57
  • I don't understand why this affects less in the first place. it doesn't run a shell, so why would your shell prompt have any effect on it? – Barmar Apr 13 '16 at 18:27
  • @Barmar - have a look over here: greenwoodsoftware.com/less/faq.html#profileout less DOES run a shell... – Bak Itzik Apr 17 '16 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.