1

my router runs asuswrt merlin. the /bin/sh is packaged in BusyBox v1.25.1 (2017-12-02 00:49:46 EST) multi-call binary.

my question is how do I move my cursor one word left and right?

with bash, i can do option+left, option+right, which is mapped in terminal to \033b and \033f respectively.

on my router's shell, it just prints a b and an f. so how do i remap shortcuts in shell or what out of the (busy)box shortcut is there?

Note 1: i found that busybox supposedly packages ash shell, so my question may be how to move cursor one word with ash shell.

Note 2: i tried enabling and disabling the following option to use meta+b and meta+f, no luck

using option as meta key

Note 3: added apple and ash tags

  • So when you say option+left you are on a Apple computer? If so, you may want to add Apple tag. – Mark Stewart Jan 25 '18 at 15:46
1

Meta-F and Meta-B will move the cursor forward and back word by word, respectively.

If you're on a terminal or connection chain that does not properly pass the Meta key along for the ride, as appears to be your case, Esc is a signal that the next character sent it meant to be a keystroke altered by Meta. So: Press and release Esc, followed by F or B to go forward or back in word-by-word your remote terminal, respectively.

That said, when a command line I'm working on is complex enough to set right that I need anything more complex than Ctrl-A or Ctrl-E, I will usually just open it up in my configured EDITOR with Ctrl-X, Ctrl-E.

  • when i press meta+b and meta+f i get ƒ and , so that doesn't seem to be the right shortcut. – believesInSanta Jan 25 '18 at 15:27
  • Meta and Option are two wholly different keys. Did you try Esc,F and Esc,B? – DopeGhoti Jan 25 '18 at 15:32
  • i'm on macOS so terminal has this option to send meta using the option key, which i've tried both – believesInSanta Jan 25 '18 at 15:33
  • If you're getting ƒ and ∫, that means the Mac is handling its keyboard shortcuts for the Option key before your keystroke is making it to the Terminal program you are using. Try the Escape-based alternative which does not require the use of Meta. – DopeGhoti Jan 25 '18 at 15:36
  • 2
    The questioner actually did say in the question that this is the Almquist shell, as included in BusyBox. That does not use Readline. But it does have word motions in its own line editing library. – JdeBP Jan 25 '18 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.