Search code examples
linuxbashvimvi

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.


Solution

  • 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.