Дана 24/07/30 05:32PM, Kirill A. Korinsky написа: > I think this way is cleaner, isn't it? > > set -A complete_doas_1 -- $(echo $PATH | tr ':' '\n' | xargs ls)
Or, to limit the types of files to regular files or symlinks with execute bit set and avoid parsing the output of ls[1]: set -A complete_doas_1 -- $(find $(echo $PATH | tr : ' ') -perm -100 \ \( -type f -o -type l \) -maxdepth 1 ) or to just output the command names: set -A complete_doas_1 -- $(find $(echo $PATH | tr : ' ') -perm -100 \ \( -type f -o -type l \) -maxdepth 1 -exec basename {} ';' ) In any case, this fills up memory in the shell by creating fairly large arrays. Alternative: type a command using normal Tab completion but without the doas "prefix", Ctrl-A, type "doas ", press Enter. [1]: https://unix.stackexchange.com/questions/128985/why-not-parse-ls-and-what-to-do-instead