I run the following vim search-and-replace command within a bash script:
#!/bin/bash
...
vim -c ':%s/candle/light/g | write | quit' file.txt
...
The command above opens a file, replaces every 'candle' with 'light', save and quit.
The problem is that when no word 'candle' is found within that file, the whole script is interrupted. And I can see vim saying:
E486: Pattern not found: candle
How can I run the command silently without interrupting the bash script?