agarwal_achhnera
agarwal_achhnera

Reputation: 2456

editing file through vi editor in shell script show error

script in which I open a file in vi editor , after that user will write any thing in it then save or quite by :wq!

When I try this then it give an error message as below

e138 can't write viminfo file $home/.viminfo!

and ask for,

Press Enter or command to continue

Now when I press enter then file save. But why that error message shows. If I open same file direct with vi editor or vim editor and do changes then it does not give any error.

also if I install vim editor then it works fine and no error shows

Please tell me what may be the issue.

Upvotes: 0

Views: 1430

Answers (2)

Christian Seitz
Christian Seitz

Reputation: 802

I came here with mostly the same error, but this answer did not work for me. I had to create more space within my $HOME directory by deleting a few files, and then vim worked normally again.

Upvotes: 0

ygoncho
ygoncho

Reputation: 367

my best guess is that $home is not defined properly. try running: !echo $home on both editors. If it's not defined during the script run, define it before running vim.

Upvotes: 2

Related Questions