Hi All,
I was looking to open a file using vim within shell script. Can someone please suggest a way/syntax for this?
Thanks in advance.
Hi All,
I was looking to open a file using vim within shell script. Can someone please suggest a way/syntax for this?
Thanks in advance.
what exactly are you trying to do?
if you just want to run the vim command from the script, try this
$ cat testfile
This is a test file
$ cat vimtest
#!/bin/bash
echo "Opening $1 in vim"
vim $1
echo "Closed $1"
$ sh vimtest testfile
Opening testfile in vim
Closed testfile
vi editor will be launched after 1st echo and once you close the editor, script will exit after 2nd echo.
I wanted to run vim -d <file1> <file2> command from a shell script. How can I do that?
you can simply run this command from the script by passing both the arguments.
what problem/error are you facing with this ?
Actually, this is not my intention. I just wanted to check whether redirecting the output of vim -d <file1> <file2> to some file, exports the output in plain text format or it adds some color code related stuff in that? Basically, I wanted to produce colorful difference in a html format.
---------- Post updated at 06:18 AM ---------- Previous update was at 06:05 AM ----------
Please don't bother. I tried it and it shows junk characters.
vim -- you are not expected to run it from a shell script or from something else. It is mainly for interactive things.
You have to take a look at diff, colordiff.
But nothing will produce colorful output to a file. You can use this at terminal, as it is designed for that.