HOME and END keys don't work, replaced Busybox with BASH

I am aware you continue to link the commands to the busybox version. The issue is, I've never experienced someone changes shell on OpenWrt (because of various issues, one you're expriencing now).

I think someone else would be better to explain the issue.

Anyways, despite you think I don't know Linux, confirm that the HOME and END keys and history are programmed to work on the version compiled for OpenWrt.

Been a long time since I used bash on OpenWrt, as pretty much all the things you note as desirable can be built into Busybox ash. They are not turned on by default, so you will have to build your own image to get the extra functionality.

iirc correctly, one hurdle in getting things functioning was to edit /etc/passwd, there could be more...

1 Like

I am using this line in rc.local

test -x /bin/bash && sed '/^root/ s_/bin/.*_/bin/bash_g' -i /etc/passwd || sed '/^root/ s_/bin/.*_/bin/ash_g' -i /etc/passwd

so it is easy to update without any stress.

I don't want to compile my own firmware image - only to have such feature - thats really to mush.

I just like to use bash history search (ctrl+s), because I heavily use it on all my maintained systems with bash and it speed up my work.

And there are other advanced bash things, which are not availible in busybox. To say a new example: PIPESTATUS

http://lists.busybox.net/pipermail/busybox/2007-July/062422.html

I didn't know, that we need to start a fundamental discussion about shells, when I was asking if someone knows how to solve my problem. :roll_eyes:

oh -- and busybox history is very limited - to how many entry's ?! :wink:

I set in bash this, which gives me 1000 commands history:

root@AC1750:~# cat /etc/profile.d/bash.sh
#!/bin/sh

[ -z "$PS1" ] && return
[ -z "$BASH_VERSION" ] && return

shopt -s checkwinsize

HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

My intent was not to start a shell discussion, I would point you at a post I put on the OpenWrt forum years back, but well..

At any rate since you ask, what ever set it to:

CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_HISTORY=512
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y

My intent was not to start a shell discussion

It was not addressed to you :smile:

At any rate since you ask, what ever set it to

yes, your see it is fixed compiled in - not really flexible - it is bad, when I want to fit it to my needs, that I need to recompile the binary.

long story short - no one has a idea, why bash don't work properly.

Maybe someone else..... :face_with_monocle:

I agree.

Perhaps you shouldn't insult those responding to you. Respectfully, your statement doesn't seem to address anyone in particular.

I apologize you feel that everyone you're encountering doesn't know shells or Linux. Perhaps it's a misunderstanding of what OpenWrt is. I honestly think what you desire has to be compiled into OpenWrt. You also keep mentioning the history, you are aware that in the default install of OpenWrt, that the history is wiped at logoff, correct?

This behavior is similar to MOST router OSes (Cisco, Juniper, etc.). I've never seen the history in a router OS persist over multiple sessions as you describe anyways.

This is not a desktop or server Operating System. This is why I suggest that you confirm that the features that you desire in bash - are actually written into the OpenWrt version.

I'd look into however termcap or the equivalent is handled, as well as perhaps libreadline.

I've never tried [home] and [end], as ctrl-A and ctrl-E (or your choice of vi-esque bindings) is second nature for me.

You might also want to install sudo and create a user that has bash as their shell. It's considered best practice to not muck with root's shell. bash is quickly losing favor as the shell for core operations, with sh, dash or a similar lightweight shell, rather than hack of /bin/sh being a mode of bash. Debian and Ubuntu have already moved that way. FreeBSD never left.

1 Like

sorry - but this discussion leed to nothing helpful for me. And yes, I know OpenWRT is just OpenWRT - but I am really happy with it - and I am mush more happy, that it has a bash-package.

Whats wrong with it to ask for help?`

yes, but many many ppl change dash back to bash, because of compatibility :wink: - just google for it and your know what I mean.

Nothing wrong to ask, what is wrong is not to listen.

Tab-completion works with the default shell, @anomeome has pointed out how to build a version with most of the features you desire. It's been pointed out that others don't have the problems that you are having, yet you apparently haven't started to figure out what is wrong with your configuration.

bash is, by definition, incompatible. It's one thing to use it for day-to-day use, a completely different thing to use it for system administration. It is critical that scripts have the intended behavior when running with escalated privilege, in exactly the same way as the system would execute them. That said, there shouldn't be any "day-to-day" use of a device intended to provide security.

1 Like

oh man ...

at first - I was asking for BASH and not for a other shell... I know others shell are also present and working in the way the do!

the second thing is that it is my choice!

and also:

all scripts use #!/bin/sh in the header - SO THEY USE NOT BASH - only when I remove the symlink from /bin/sh to busybox.

I (for one) 100% inderstand. Bash doesn't work for you, your title originally said you has issue with the HOME and END keys. You then described fruther that you also want command line history. I COMPLETELY UNDERSTAND THIS.

  • You asked if we knew what's wrong with it
  • Instead, we're telling you how to fix it
  • We also understand scripts begin with

I suggested this:

Your issue may be that you have to compile them in yourself. but you stated:

I am be 100% sure, that is no feature that need to be compiled in.

It is like someone has a problem with it`s car... U only say - use a other car

thats no solution - only when the problem car has really fatal problems where cost of repair is more than the price of a new car.

But a price we cant compare on software. there are other facts more interesting.

1 Like

Alternatives have been provided to get most of the behavior you have asked for. Paths to try to find out why your install of bash is not behaving as you might desire have been provided. Why not stop flaming and start looking at your install and where it might be missing the information required to respond to the [end] and [home] keys? Since you're "100% sure" I take it you've looked at the package make file and the configuration of bash and all the OS hooks it needs. Or have you?

A quick check, since you have prodded one to use Google, would reveal that [end] and [home] are not documented as being bound in bash by default.

8.4.1 Commands For Moving

beginning-of-line (C-a)
Move to the start of the current line.

end-of-line (C-e)
Move to the end of the line.

Here's your answer -- which has nothing to do with OpenWRT, so stop whining.

2 Likes

I am not flaming - and yes I have looked in the Makefile, but I am not so deep inside bash coding (on C) and Makefiles and all thouse deep inside things.

And to instantly repeating that I should not use bash is not really helpful.

I googled, but didn't found this (maybe my google foo is to bad). THIS is the first really on topic helpful answer and get me a little bit closer to the solution. :+1:

I am not frustrated that I don't get a answer - I be because I get forced and hunted that I want to use bash.

"You can lead a horse to water, but you can't make them drink."

The path to your answer has been posted, yet you haven't even looked at it.

No, I have it - and look into it right now... will see if the inputrc works.

EDIT: year, your my king :slight_smile:

It works.

Is only my file/folder expansion problem left. On a other LEDE router with bash (BASH_VERSION='4.3.42(1)-release'), it is not present. So it look like it is new.

hmm... maybe the inputrc should be delivered with libreadline package - than it has something todo with OpenWRT :zipper_mouth_face: