Adding to Jeff's comment, it repeats the previous command and at least on all the bashes I've used it will also print out the the command for you to see what you just did, which might explain the cat textFileName that you're seeing. That output is writen to the ternminal, not printed to stdout or stderr. For example:
$ cat textFile
helloworld
$ !!
cat textFile
helloworld
$ !! &>/dev/null
cat textFile &>/dev/null
So that line being printed is just displayed to you for your help, it's not part of the output that would show up in, say, a pipeline if you used !!
I was "inspired" this afternoon by the updated requirement:
Use the !! command such that helloworld (and nothing more) is printed on standard out, and nothing is printed on standard error when the command is entered. You can precede your command with other commands (e.g., to create a file, run other commands, etc.) and/or pass options or arguments to your commands. And yes, nothing more means nothing more.
...which seems sufficiently made-up for me to suggest this answer/workaround:
exec ksh
PS1="helloworld"
!! 2>/dev/null
Use printf instead:
printf 'Hello, \nWorld!\n'
printf behaves more consistently across different environments than echo.
Make sure you are in Bash:
echo $0
Output:
bash
All of these work for me:
echo -e "Hello,\nworld!"
echo -e 'Hello,\nworld!'
echo Hello,$'\n'world!
echo Hello, ; echo world!