I want bash shell that does the following
bashpromt# cat mybash.sh
echo "about to open a file"
vim file.txt #I need to use vim application to open a file
#now write something into file.txt
#close the that file.
Vim has several options:
-c=> pass ex commands. Example:
vim myfile.txt -c 'wq'to force the last line of a file to be newline terminated (unless
binaryis set in some way by a script)
-s=> play a scriptout that was recorded with
-W. For example, if your file contains
vim myfile.txt -s the_file_containing_ZZwill do the same as previously.
Also note that, invoked as
ex, vim will start in ex mode ; you can try
ex my_file.txt <<< wq