2

I need to develop a simple text interface for an embedded system with more or less only the Busybox installed on it.

For my purposes the read shell built-in would have sufficed. But the Busybox ash (or any other shell, they use the same code for the built-in) does not support line editing or initial text in the read built-in.

Does anybody knows of a way in Busybox's ash to emulate bash's read -e -i <initial-text> in a shell script?

Dummy00001
  • 16,630
  • 5
  • 41
  • 63

1 Answers1

0
  1. For readline emulation, there's rlwrap assuming it can be made to fit on the embedded system. Invoke like so: rlwrap ash, which provides command line history and editing.

  2. For read -e -i "foo" bar emulation, try:

    read bar ; bar="foo$bar"
    
agc
  • 7,973
  • 2
  • 29
  • 50