Add autocompletion in dash
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.