csh: history command numbers out of whack

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm forced to run csh and I'd like to accomplish two things:



  1. Merge command history between multiple sessions and have the history available across all sessions (not just after logout).

  2. Format the history output to determine when a command was performed to track my steps (I'd like to have a sequential history which shows me what I did to accomplish something).

So far in my .cshrc I have the following:



alias precmd 'history -S; history -M'
#setting history size and formatting
set history=(100000 "%h %W/%D/%Y %T %Rn" )
set histdup=erase
set savehist=(100000 merge lock)


However, after doing this, running the history command increments the %h (the command number) by the set of commands I had previously run.



For instance, if I had only 1 command in history, running history would output:



1 command
2 history


and running history thereafter, does the following:



3 command
4 history
5 history


How do I fix this?







share|improve this question


















  • 3




    You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
    – Jeff Schaller
    Mar 7 at 17:57










  • Sorry @JeffSchaller but that is not the answer I am looking for
    – Chirag C
    Mar 7 at 18:44






  • 1




    That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
    – Jeff Schaller
    Mar 7 at 18:46










  • I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
    – cas
    Mar 8 at 3:02











  • Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
    – Chirag C
    Mar 9 at 19:31














up vote
0
down vote

favorite












I'm forced to run csh and I'd like to accomplish two things:



  1. Merge command history between multiple sessions and have the history available across all sessions (not just after logout).

  2. Format the history output to determine when a command was performed to track my steps (I'd like to have a sequential history which shows me what I did to accomplish something).

So far in my .cshrc I have the following:



alias precmd 'history -S; history -M'
#setting history size and formatting
set history=(100000 "%h %W/%D/%Y %T %Rn" )
set histdup=erase
set savehist=(100000 merge lock)


However, after doing this, running the history command increments the %h (the command number) by the set of commands I had previously run.



For instance, if I had only 1 command in history, running history would output:



1 command
2 history


and running history thereafter, does the following:



3 command
4 history
5 history


How do I fix this?







share|improve this question


















  • 3




    You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
    – Jeff Schaller
    Mar 7 at 17:57










  • Sorry @JeffSchaller but that is not the answer I am looking for
    – Chirag C
    Mar 7 at 18:44






  • 1




    That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
    – Jeff Schaller
    Mar 7 at 18:46










  • I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
    – cas
    Mar 8 at 3:02











  • Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
    – Chirag C
    Mar 9 at 19:31












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm forced to run csh and I'd like to accomplish two things:



  1. Merge command history between multiple sessions and have the history available across all sessions (not just after logout).

  2. Format the history output to determine when a command was performed to track my steps (I'd like to have a sequential history which shows me what I did to accomplish something).

So far in my .cshrc I have the following:



alias precmd 'history -S; history -M'
#setting history size and formatting
set history=(100000 "%h %W/%D/%Y %T %Rn" )
set histdup=erase
set savehist=(100000 merge lock)


However, after doing this, running the history command increments the %h (the command number) by the set of commands I had previously run.



For instance, if I had only 1 command in history, running history would output:



1 command
2 history


and running history thereafter, does the following:



3 command
4 history
5 history


How do I fix this?







share|improve this question














I'm forced to run csh and I'd like to accomplish two things:



  1. Merge command history between multiple sessions and have the history available across all sessions (not just after logout).

  2. Format the history output to determine when a command was performed to track my steps (I'd like to have a sequential history which shows me what I did to accomplish something).

So far in my .cshrc I have the following:



alias precmd 'history -S; history -M'
#setting history size and formatting
set history=(100000 "%h %W/%D/%Y %T %Rn" )
set histdup=erase
set savehist=(100000 merge lock)


However, after doing this, running the history command increments the %h (the command number) by the set of commands I had previously run.



For instance, if I had only 1 command in history, running history would output:



1 command
2 history


and running history thereafter, does the following:



3 command
4 history
5 history


How do I fix this?









share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 18:45









aliceinpalth

760116




760116










asked Mar 7 at 17:48









Chirag C

11




11







  • 3




    You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
    – Jeff Schaller
    Mar 7 at 17:57










  • Sorry @JeffSchaller but that is not the answer I am looking for
    – Chirag C
    Mar 7 at 18:44






  • 1




    That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
    – Jeff Schaller
    Mar 7 at 18:46










  • I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
    – cas
    Mar 8 at 3:02











  • Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
    – Chirag C
    Mar 9 at 19:31












  • 3




    You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
    – Jeff Schaller
    Mar 7 at 17:57










  • Sorry @JeffSchaller but that is not the answer I am looking for
    – Chirag C
    Mar 7 at 18:44






  • 1




    That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
    – Jeff Schaller
    Mar 7 at 18:46










  • I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
    – cas
    Mar 8 at 3:02











  • Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
    – Chirag C
    Mar 9 at 19:31







3




3




You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
– Jeff Schaller
Mar 7 at 17:57




You may be "forced" to use csh as your login shell, but if other shells exist on the server, you could look for & execute them as part of your csh login.
– Jeff Schaller
Mar 7 at 17:57












Sorry @JeffSchaller but that is not the answer I am looking for
– Chirag C
Mar 7 at 18:44




Sorry @JeffSchaller but that is not the answer I am looking for
– Chirag C
Mar 7 at 18:44




1




1




That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
– Jeff Schaller
Mar 7 at 18:46




That's why it's a comment and not an Answer. I was just replying to your comment "I'm forced to run csh"
– Jeff Schaller
Mar 7 at 18:46












I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
– cas
Mar 8 at 3:02





I agree with @JeffSchaller - running "exec bash" was the first thing I always did on machines where csh or even plain old sh was the default and changing the shell wasn't an option (usually because changing root's shell is a bad idea - can break root's crontab, amongst other probs). Also you may be mis-interpreting "My shell is csh because that's the default" as "I'm forced to use csh" - have you tried running chsh -s /path/to/other/shell (note: the other shell must be listed in /etc/shells for this to work).
– cas
Mar 8 at 3:02













Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
– Chirag C
Mar 9 at 19:31




Ok, at the risk of sound like being a jerk (which is not what I'm trying to do), I simply want to know of other means of accomplishing what I want to do, seriously there has got to be anothe way of getting this working
– Chirag C
Mar 9 at 19:31















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428812%2fcsh-history-command-numbers-out-of-whack%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428812%2fcsh-history-command-numbers-out-of-whack%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)