Tcsh precmd weird question


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 3 Weeks Ago
Tcsh precmd weird question

I encountered a weird question while using tcsh. I wrote a test script trying to control 'history' behavior as below,

Code:
set history=(1000 "%h\t%Y-%W-%D %P %R\n")
set savehist=(1000 merge)
alias precmd 'history -S;history -M'

I was hoping all the user's commands input in multiple terminals can be recorded to the history file without lose.
My script can worked well in RHEL 6 ( the default tcsh version is 6.17).
However, when I tested my script in RHEL 4/5 (tcsh version 6.13 / 6.14), the precmd alias resulted in command line in malfunction.
Whatever I input on the command line after running my script, it was just jumping to the newline, nothing happened.

I have no idea what went wrong. Does anybody have idea? Thanks.
# 3  
Old 3 Weeks Ago
Quote:
Originally Posted by Corona688
What does 'jumping to the newline' mean?
Sorry, I didn’t describe it clearly.
I mean after running my script, I input any coomands and then press enter, it shows nothing. I can’t even use exit command to close the terminal.
# 4  
Old 3 Weeks Ago
I can reproduce this with tcsh 6.12. After
Code:
alias precmd 'history -S;history -M'

it only echos the typed commands, without running them.
Looks like a bug.
Try
Code:
alias postcmd 'history -S;history -M'

Doesn't this even make more sense?
This User Gave Thanks to MadeInGermany For This Post:
bestard (3 Weeks Ago)
# 5  
Old 3 Weeks Ago
Quote:
Originally Posted by MadeInGermany
I can reproduce this with tcsh 6.12. After
Code:
alias precmd 'history -S;history -M'

it only echos the typed commands, without running them.
Looks like a bug.
Try
Code:
alias postcmd 'history -S;history -M'

Doesn't this even make more sense?
Thank you for confirming this.
It seems like no workaround, does it?

I haven’t tried postcmd, I ‘ll try this to see what happen. Thanks.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Tcsh to sh emily Shell Programming and Scripting 5 04-23-2014 11:44 AM
Help in tcsh script nrjrasaxena Shell Programming and Scripting 10 08-26-2012 12:29 AM
perl in tcsh nrjrasaxena Shell Programming and Scripting 4 08-17-2012 02:49 PM
tcsh help Bic121 Shell Programming and Scripting 2 11-28-2011 03:37 PM
logging out in tcsh jacki Shell Programming and Scripting 3 09-07-2010 09:58 PM
About tcsh shell darshakraut UNIX for Dummies Questions & Answers 3 10-21-2009 02:54 AM
simple tcsh question using foreach moldoverb Shell Programming and Scripting 1 01-07-2009 07:05 PM
arithmetic in tcsh gobi Shell Programming and Scripting 4 05-28-2008 09:05 PM
help in tcsh mahendrakamath UNIX for Dummies Questions & Answers 3 11-12-2007 03:05 PM
Help me with this tcsh script.!!!! kumarsaravana_s Shell Programming and Scripting 6 03-12-2007 06:10 AM
Kind of weird question Cyberaxe UNIX for Dummies Questions & Answers 2 07-26-2005 05:19 PM
Weird Question rahulrathod UNIX for Advanced & Expert Users 4 10-21-2004 04:48 AM
tcsh kartik Shell Programming and Scripting 1 10-20-2004 05:05 PM
tcsh and redirect Micky UNIX for Dummies Questions & Answers 1 06-26-2001 11:15 AM