name: "Builtins: echo" cases: - name: "echo with only --" stdin: echo -- - name: "echo with -- and args" stdin: echo -- -1 --"aaa" ?^1as- - name: "echo -e" stdin: | echo -e "1. \x65" | hexdump -C echo -e "2. \x{65}" | hexdump -C - name: "echo options after an operand are operands" stdin: | echo hi -n echo a -e 'x\ty' echo -e a -n f() { echo "$@"; } f a -n - name: "echo with repeated options" stdin: | echo -n -n a; echo " rc=$?" echo -nn b; echo " rc=$?" echo -e -e 'c\td' echo -n -e -n 'e\tf'; echo - name: "echo uses the last of -e and -E" stdin: | echo -e -E 'a\tb' echo -E -e 'c\td' echo -eE 'e\tf' echo -Ee 'g\th' - name: "echo words that are not options" stdin: | echo - a echo -nx b echo -n -x c echo -e -- 'd\te' echo -n - name: "echo interprets escapes with xpg_echo" known_failure: true # TODO(echo): xpg_echo is not implemented stdin: | shopt -s xpg_echo echo 'a\tb' echo -E 'c\td' - name: "echo takes no options in POSIX mode with xpg_echo" known_failure: true # TODO(echo): xpg_echo is not implemented stdin: | set -o posix shopt -s xpg_echo echo -n 'a\tb' echo -e 'c' - name: "echo takes --help, -h and a word of unknown letters as operands" stdin: | echo --help echo -h echo -enx 'a\tb' echo -n -- a; echo echo -- -n