Hey how can I open vim inside a script?
I need to grade coding assignments and wrote a script to open code and note files, but vim does not open.
The script is essentially a fancier version of this:
#!/bin/bash
echo -e "$student_files" | while read student do
vim -o $student
done
#each "$student" looks like: "file1 file2 [...] notes"
But vim complains about:
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
Can anyone tell me why this is happening and how I could work around it? Thanks in advance :)
note: I tried running vim in a script without a loop, which works, but I don't know why. I suppose its because I'm piping into while
while...vimis responding to the pipeline as well.$student_filesa variable containing newlines?-ewas missing. But the real script contains asedcommand, so it works there.