5

Is it possible to get at least "some" autocompletion in a dash shell like in bash?

At least for the existing filenames in a path.

3

No, dash doesn't have completion. Otherwise it would be called bash. Dash was designed to execute shell scripts fast and with a minimum of memory, it wasn't intended to be used interactively.

The best way to get completion in dash is to run exec zsh or exec fish. Or, if you want to stick with a shell that doesn't use much memory, use a BusyBox sh build that includes completion.

If you want to stick with dash, you can do what people did before completion existed: use wildcards. For example, instead of typing a prefix of a file name and then pressing Tab, type a prefix of a file name and then type *. The prefix needs to be unique, otherwise multiple file names will be interpolated.

To list “completions”, call ls or run echo on the wildcard pattern.

If you use the same file name (or other string) multiple times, store it in a variable.

  • exec fish just closed it here (using yakuake with dash as default) – Aquarius Power Jan 23 at 15:28
  • 1
    @AquariusPower Because you did not have the fish shell installed. Both of those commands simply starts another shell in place of the current dash shell (I assume the commands were meant as a kind of a joke). – Kusalananda Jan 23 at 15:56
1

Suggesting an alternative (@...)

why dash? for me is the resident memory usage. (I use yakuake and each bash tab is 34MB here. dash is 708KB.) The problem is I am often typing bash to have autocompletion.

The alternative: yash RSS=1080KB, has excellent auto-completion (may be even friendlier than bash's one). I set it as default on yakuake and no matter how many tabs I open it is very easy on memory.

I found that having yakuake start yash with .yashrc starting bash uses +-9MB RSS instead of 34MB! then if I want to keep something like htop, i just exit bash and get the yash low memory again to run it!

complementing https://unix.stackexchange.com/a/158523/30352:
exec zsh used 5.5MB RSS (...@) as you may not want to stick with dash :)

Obs.: RSS thru htop

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.