Last active
January 27, 2016 21:06
-
-
Save dprea/a35863788bcb93f3eb97 to your computer and use it in GitHub Desktop.
Shell Script - Open Vim then Write Text then Save and Quit Vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uses Vim to create a text file (file.txt) with text 'hello' | |
# Save and quit Vim | |
vim file.txt -c '$put =\'hello\' -c 'wq' | |
# ----------------------------------------------------------------------------------------- | |
# SOURCE http://stackoverflow.com/questions/5978108/open-vim-from-within-bash-shell-script | |
# ----------------------------------------------------------------------------------------- | |
# vim -c | |
# -c => pass ex commands. | |
# Example: vim myfile.txt -c 'wq' to force the last line of a file to be newline terminated | |
# (unless binary is set in some way by a script) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment