csh: history command numbers out of whack

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm forced to run csh and I'd like to accomplish two things:
- Merge command history between multiple sessions and have the history available across all sessions (not just after logout).
- 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?
linux command-history csh
add a comment |Â
up vote
0
down vote
favorite
I'm forced to run csh and I'd like to accomplish two things:
- Merge command history between multiple sessions and have the history available across all sessions (not just after logout).
- 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?
linux command-history csh
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 wherecshor even plain oldshwas 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 runningchsh -s /path/to/other/shell(note: the other shell must be listed in/etc/shellsfor 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 ofothermeans 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
add a comment |Â
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:
- Merge command history between multiple sessions and have the history available across all sessions (not just after logout).
- 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?
linux command-history csh
I'm forced to run csh and I'd like to accomplish two things:
- Merge command history between multiple sessions and have the history available across all sessions (not just after logout).
- 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?
linux command-history csh
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 wherecshor even plain oldshwas 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 runningchsh -s /path/to/other/shell(note: the other shell must be listed in/etc/shellsfor 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 ofothermeans 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
add a comment |Â
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 wherecshor even plain oldshwas 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 runningchsh -s /path/to/other/shell(note: the other shell must be listed in/etc/shellsfor 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 ofothermeans 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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
cshor even plain oldshwas 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 runningchsh -s /path/to/other/shell(note: the other shell must be listed in/etc/shellsfor 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
othermeans 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