Hi,
I would like to embed vim code inside bash script.
I have simple text file text_file.txt with content:
aaa
Content sample.sh file:
#!/bin/bash
echo "Start running vim commands inside bash program."
vim +"so dummy.vim" << EOF
:e text_file.txt
:s/a/b/
:x
EOF
echo "End of running run vim commands inside bash program."
Above code opens text_file.txt, replaces letter a with b and saves the file.
When I run sample.sh file from shell: ./sample.sh
The output on terminal is:
Start running vim commands inside bash program.
Vim: Warning: Input is not from a terminal
End of running run vim commands inside bash program.
and script does get executed, so file text_file.txt correctly gets changed to baa
The only little bit annoying thing is the Vim: Warning: Input is not from a terminal message in terminal. How to suppress this message?
Thanks.