-1

I am facing the following error

bash: !": event not found

while i have write the following command

echo "HI"  test.txt  

in terminal,

whats the problem?

Md. Tanvir Raihan
  • 4,075
  • 9
  • 37
  • 70

2 Answers2

2

You are probably typing it as:

echo "HI!" >> test.txt

! is a special character in bash (Linux) and needs to be escaped like so:

echo "HI\!" >> test.txt

I think this question is answered very well in this link: https://serverfault.com/questions/208265/what-is-bash-event-not-found?newreg=2077048244ee45dbb6f7d1925d71458f

Hope this helps.

Community
  • 1
  • 1
0

You have a syntax error in your command, You need to add the '>>' between your text and your name file and also try removing the quotes:

echo HI >> test.txt 
ianaya89
  • 4,153
  • 3
  • 26
  • 34