LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Dash shell command history not working (https://www.linuxquestions.org/questions/linux-newbie-8/dash-shell-command-history-not-working-4175671100/)

Guru prasad 03-10-2020 12:22 PM

Dash shell command history not working
 
Hi,

Recently I switched my default shell from bash to dash. Now when I press arrow keys in the terminal to get back command history, I get ^[[A or ^[[C. I tried with HISTFILE option but didnt work..I want to use dash shell with history enable option..Please help me...

TB0ne 03-10-2020 12:50 PM

Quote:

Originally Posted by Guru prasad (Post 6099192)
Hi,
Recently I switched my default shell from bash to dash. Now when I press arrow keys in the terminal to get back command history, I get ^[[A or ^[[C. I tried with HISTFILE option but didnt work..I want to use dash shell with history enable option..Please help me...

Did you read the man page on the dash shell? Look at the HISTSIZE option and set it. And I'd ask why you'd change the default shell to start with...what is your goal? What are you trying to get with the dash shell that bash doesn't give you?

michaelk 03-10-2020 05:33 PM

Welcome to LinuxQuestions.

Not a HISTFILE or HISTSIZE problem.

What you are seeing is the shell's interpretation of the up and down arrow key codes. When you switched to dash, the shell appears to not have read the keybindings. Since dash uses the same keybindings file as bash i.e. inputrc and without knowing what distribution you are running my first suggestion would be to just log out then back in.

You can also try running the command:
bind -f /etc/inputrc

What happens if you start anouther terminal window?

TB0ne 03-10-2020 07:27 PM

Quote:

Originally Posted by michaelk (Post 6099295)
Welcome to LinuxQuestions.

Not a HISTFILE or HISTSIZE problem.

What you are seeing is the shell's interpretation of the up and down arrow key codes. When you switch to dash the shell appears to have read the keybindings. Since dash uses the same keybindings file as bash i.e. inputrc and without knowing what distribution you are running my first suggestion would be to just log out then back in.

You can also try running the command:
bind -f /etc/inputrc

What happens if you start anouther terminal window?

Nice one; didn't consider that. I've had it happen before with dash, but I have only used it once or twice, and it was because of HISTSIZE being set to 0. But you're absolutely right, though, when you think about the escape sequences being presented on the screen. Perfect sense, good catch.

Guru prasad 04-03-2020 02:09 AM

Quote:

Originally Posted by TB0ne (Post 6099198)
Did you read the man page on the dash shell? Look at the HISTSIZE option and set it. And I'd ask why you'd change the default shell to start with...what is your goal? What are you trying to get with the dash shell that bash doesn't give you?

Sorry for the very late reply....I am trying dash because it is very minimal....Apparently by setting dash to vim mode solved the problem...Thank you all for your suggestions...


All times are GMT -5. The time now is 07:59 AM.