Hey all,
I work in a group environment where multiple people may end up editing the same file. We have measures in place so no two people can edit the same file at once. I have a script that does the following:
call: script file
The script will backup the file,
Moves the file to a safe/busy name, ie: file_in_use (this lets other users know it's busy)
Calls vi to edit it,
I edit the file, then exit vi,
When I exit vi, the script then continues, by
Moving the edited file back to its original name, and
the script exits.
It looks like this bare bones example:
#protect original file
backup file to archive/bak_file_date
#create alternate file to edit.
mv file file_in_use
#edit the alt file
vi file_in_use
#after exiting vi, rename file to original name
mv file_in_use file
exit
This works brilliantly with vi. But in trying to engage gvim (vim) from within the script, gvim lets the script run its course and exit, then gvim edits "file_in_use," or, effectively, a new file named file_in_use.
When I call vi, it seems to stop or hold up the script until it's done with it, then the script continues with the subsequent steps.
I do not understand how to get gvim to act the same way as vi does.
Or can it?
Thanks in advance.
-Bruce