In this case, I'd use cat
with a (quoted) here-document:
cat <<'END_CAT'
/\_/\
( o.o )
> ^ <
END_CAT
This is the best way of ensuring the ASCII art is outputted the way it is intended without the shell "getting in the way" (expanding variables etc., interpreting backslash escape sequences, or doing redirections, piping etc.)
You could also use a multi-line string with printf
:
printf '%s\n' ' /\_/\
( o.o )
> ^ <'
Note the use of single quotes around the static string that we want to output. We use single quotes to ensure that the ASCII art is not interpreted in any way by the shell. Also note that the string that we output is the second argument to printf
. The first argument to printf
is always a single quoted formatting string, where backslashes are far from inactive.
Or multiple strings with printf
(one per line):
printf '%s\n' ' /\_/\' '( o.o )' ' > ^ <'
printf '%s\n' \
' /\_/\' \
'( o.o )' \
' > ^ <'
Or, with echo
(but see Why is printf better than echo? ; basically, depending on the shell and its current settings, there are possible issues with certain escape sequences that may not play nice with ASCII drawings),
echo ' /\_/\
( o.o )
> ^ <'
But again, just outputting it from a here-document with cat
would be most convenient and straight-forward I think.