cat.md

December 12, 2014 ยท View on GitHub

cat

POSIX 7: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html

Concatenate files to stdout.

echo asdf > a
echo qwer > b

[ "$(cat a)" = 'asdf' ] || exit 1
[ "$(cat b)" = 'qwer' ] || exit 1

[ "$(cat a b)" = "$(printf 'asdf\nqwer'") ] || exit 1

Stdin:

[ "$(echo a | cat)" = 'a' ] || exit 1