Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using tcsh quite extensively and have several questions about it's history:

  • Is there a way to save commands for different shell tabs separately?
  • Is there a way to save commands by session (for cases like this: ssh otheruser@othercomputer)?
  • Can I add dates to the shell history? (I know this can be done in bash)
share|improve this question

migrated from stackoverflow.com May 7 '12 at 21:46

This question came from our site for professional and enthusiast programmers.

    
This helped me solve the dates issue. –  White Zebra May 15 '12 at 16:25

1 Answer 1

up vote 1 down vote accepted

There isn't a built-in method of saving saving the command history separately or by session. You would have to set your 'histfile' variable on a per-instance basis. This means you would need something unique in your environment that is present already when your .tcshrc file is sourced, or add code to yourself to the very top of your .tcshrc that finds some unique value, perhaps from the tty command.

Take care to only do this when you're in an interactive shell so that it won't unnecessarily slow down or complicate other things that spawn new tcsh shells that you might not expect. For example, if you're using vim and you execute any shell commands, the tty command won't behave.

I usually use the prompt3 method...

if ( $?prompt3 ) then
    #
    # interactive-only things...
    #
endif

For a separate history, might be able to get away with something like:

set mytty = ( `tty` )
set histfile = ( ".history.${mytty}" )
share|improve this answer

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.