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 8993257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:09:12+00:00 2026-06-15T23:09:12+00:00

( Crossposted to unix.stackexchange.com ) This question and the answer teach us how to

  • 0

(Crossposted to unix.stackexchange.com)

This question and the answer teach us how to introduce colour into tcsh prompts.

This webpage explains nicely how to get colour into any output of the echo command:

> echo \\e[1\;30mBLACK\\e[0m
BLACK
> echo '\e[1;30mBLACK\e[0m'
BLACK

The word ‘BLACK’ in the example above is printed with a black (or darkgrey) foreground colour (depending on the overall color scheme).

Now I’d like to introduce this into the [TAB] command autocompletion feature of tcsh. I tried:

complete testcmd 'p/*/`echo '"'"'\e[1;30mf834fef\e[0m'"'"'`/'

And I get:

> testcmd [TAB]
> testcmd ^[\[1\;30mf834fef^[\[0m

Obviously the characters lose their special meaning. Hopefully I just did not get the escaping right. But I tried several other ways. So any help is appreciated.

The real use case is that I’ve got a command completion that offers three different types of completions and I’d like to visually distinguish the types. Also the alternatives are computed by an external command. That is why I need the completion to use the backticks with an external command, such as echo. I don’t care about the details of this command. If you make it work in any way with the tcsh‘s complete command I’ll probably be able to adapt (thinking perl -pe wrappers and such).

The reason why I believe this has to work somehow is that the tcsh itself offers coloured command completion if you e.g. type ls [TAB]. That works correctly in my setup. Also you can use ls -1F inside the autocompletion and the colours that ls outputs are also piped through. An example would be:

complete testcmd 'p/*/`ls -1F`/'

Update: As user mavin points out, the colourization of ls in this example is indeed not piped through. The colours of ls are lost, but the auto completion can reapply colours according to LS_COLOURS variable based on hints such as the / and * marker endings as added by the ls. This can be verified by doing

complete testcmd 'p/*/`ls --color -1`/'

which fails to provide colour, and only provides garbled output. (Literally pipes through the escape character sequences)

I’m on tcsh version 6.13.00

Any ideas? Pointers?

  • 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-06-15T23:09:14+00:00Added an answer on June 15, 2026 at 11:09 pm

    In your example, complete testcmd 'p/*/ls -1F/', the colours aren’t getting passed through from ls. You’ll find that you get colour here even if you set ls to produce monochrome output, but not if you leave off the -F. What’s happening is that tcsh is doing its own colouring based on the symbols added to the end of each filename by ls -F. For example:

    complete testcmd 'p%*%`echo dir/ symlink@ device# socket=`%'
    

    You could exploit this in your completion generator, e.g.,

    complete testcmd 'p/*/`echo foo bar | perl -lane '"'"'print join " ", map { $_. "%" } @F'"'"'`/'
    

    The snag is that you end up with these symbols in your completed command-line, and will have to manually backspace each time.

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

Sidebar

Related Questions

Crossposted with STATS.se since this problem could straddle both STATs.se/SO https://stats.stackexchange.com/questions/17712/parallelize-solve-for-ax-b I have some
This is already cross-posted at MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/560451 I am attempting to override the
Note: This question is also cross-posted in Q.js mailing list over here . i
Note: I've cross-posted this question in the grails-user mailing list This weekend using this
Almost certainly a stupid question but I can't find the answer anywhere. In the
I've tried installing RC1 must have been 5 times already and always run into
I was reading this article which mentions storing 1Million keys in redis will use
I'm using GWT internationalization Messages. The documentation for Plural Forms says this should work:
[cross-posted on Google Products Forum http://productforums.google.com/d/topic/analytics/ZrB14a-6gqI/discussion ] I am using the following code at
This is cross-posted from the coursera functional programming course because there's a lot less

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.