Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7649967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:07:47+00:00 2026-05-31T11:07:47+00:00

I set up my tcsh xterm to update the titlebar on postcmd with the

  • 0

I set up my tcsh xterm to update the titlebar on “postcmd” with the name of the last command that was run and the directory.

This is similar to what I had (minimal example to reproduce):

alias postcmd 'echo -n "\033]0;hello_world\007";'

(note that this alias is in my .cshrc file. If just I type this on the command line, than it works 100% properly)

This successfully updates the xterm titlebar to say “hello_world” after every command that I run, except for less When I run less, I get the following terminal output:

>less abc.txt
ESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world
^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^GESC]0;hello_world^G...
(END)

The file never actually opens, it just prints this garbage string and I have to CTRL-C to cancel it. Is the bell or escape character messing up the initialization of less somehow? Any idea how I can modify this to not break less? I could just as easily use another editor, but sometimes I need to share my console with other engineers for debugging and I don’t want to confuse them if they choose to run less.

This is the actual code I am using, which has the same issue as the simple hello_world example:

alias postcmd 'set HIST = `history -h 1`; printf "\033]0;%s\007" "xterm: $HIST @ $cwd ";'

=====EDIT=====
Some additional info:

> alias less
> echo $LESS
LESS: Undefined variable
> echo $TERM
xterm
>less --version
less 382
Copyright (C) 2002 Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less

>tcsh --version
tcsh 6.13.00 (Astron) 2004-05-19 (x86_64-unknown-linux) options 8b,nls,dl,al,kan,rh,color,dspm,filec

=== MORE EDIT ===

On further debugging, I find that the problem only occurs when I put the command in my .cshrc file. If I uncomment the alias from .cshrc, and simply type the alias on the command line, then it works properly with less.

Also, having put the alias in my .cshrc , if I unalias it, it still breaks less even after being unaliased. So it seems the problem is not coming from the presence of the alias, but from being aliased while .cshrc is being executed on terminal creation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:07:48+00:00Added an answer on May 31, 2026 at 11:07 am

    Based in discussion in the comments, I don’t know what’s causing the problem, but I’ve come up with a workaround.

    I’m unable to reproduce the problem myself, even with tcsh 6.13.00 (which is fairly old, BTW).

    But creating the alias from .login, or from a file sourced from .login, seems to avoid the problem.

    In my own experiments, I aliased postcmd to a command that updates the xterm title bar with a high-resolution timestamp. With the alias defined in my .cshrc, the title bar updates rapidly as my shell starts, indicating that postcmd is executed even while init scripts are being executed, before the first interactive prompt appears. (Aliasing postcmd to something that appends information to a log file could help track this down.)

    Since .login is sourced after .cshrc, moving the alias definition to .login means that fewer commands are executed with the alias in effect. That’s not a bad idea anyway; you probably don’t need the alias other than in a login shell.

    My guess is that something in one of your startup scripts interacts with your postcmd alias in a way that messes up your terminal settings. If you’re interested, you can probably try putting the alias definition in various places in your .cshrc, to see what command triggers the problem. (A divide-and-conquer approach means you won’t have to perform a huge number of trials.)

    It would be interesting to see if the problem still exists in later versions of tcsh. It could well be a tcsh bug, but I don’t see anything relevant at http://bugs.gw.com/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this variable in tcsh: set i = ~/foo/bar.c how can I get just
I've got this line my .cshrc.user (using tcsh) set prompt = %{\033[36m%}%m%{\033[32m]%}{`echo $CLEARCASE_ROOT |
There are lots of questions that ask this or a similar question. They all
set JAVA_OPTS=-Xms256m -Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=256m -server This argument works in run.bat of jboss but
When I run the command rake:install , I get this error message: WARNING: 'require
I'm trying to write a shell script that, when run, will set some environment
//Set default values $('#name').val('First Last'); $('#email').val('you@email.com'); $('#subject').val('Subject'); $('#message').val('Message'); //Change style when user types $('#name,#email,#subject,#message').keypress(function()
set-itemproperty -path HKCU:Control Panel\Desktop -name WallPaper -value Zapotec.bmp I found this code online for
Set content of table ... ViewState[Table1] = Table1; // When remove this line, table
SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.