echo “Hello !!“ >>in_linux.txt
Yesterday I found something strange about linux terminal.
Just to test some code I wrote to a file using command
echo “hello world” >> filename.txt
It worked as expected, nothing surprising but when I ran the same command with a little bit change in text
echo “hi world !!” >> filename.txt
I completely got surprised with the output, it was not “hi world !!” in the file, but the output was
hi world echo hello world >> filename.txt
Many of you may know the fact why the output was like that, but I don’t had idea why did this happened. later I found a cool fact about “!!”. In linux terminal !! in command is replaced with the command executed previously.
Originally published at anand-pathak.tumblr.com.