# Interactive: completion with Tab. command -v python3 >/dev/null 2>&1 || exit 77 mkdir -p sub/deeper bin && touch onefile sub/inner.txt 'with space' aa1 aa2 printf '#!/bin/sh\necho ran-mytool\n' >bin/zz-mytool && chmod +x bin/zz-mytool PS1='$ ' ENV='' HISTFILE='' ZTVAR_LONGNAME=val PATH=$PWD/bin:$PATH \ python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END' # a unique file name, then a space send ls on\t\r expect onefile # a directory gets "/" and the next Tab continues inside it send cat su\tin\t\r # a name that needs quoting send ls wi\t\r expect with space # several candidates: complete the common part, then list send echo a\t\t expect aa2 send 1\r expect aa1 # command position: PATH, builtins, functions, aliases send zz-my\t\r expect ran-mytool send myfunc_long() { echo in-func; }\r send myfunc_\t\r expect in-func send alias myalias_x='echo in-alias'\r send myalias\t\r expect in-alias send unal\tmyalias_x\r # variables send echo $ZTVAR_L\t\r expect val # after a pipe is command position again; inside quotes no escaping, and # a lone candidate closes the quote send echo x | zz-my\t\r expect ran-mytool send ls "wi\t\r expect with space # nothing matches: bell, line unchanged send echo nomatch\t\r expect nomatch send exit\r END