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."
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.
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.
-- --
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/cd79d44d-2c23-4c45-9c5b-1fc259b3a73fn%40googlegroups.com.
No comments:
Post a Comment