Reputation: 1844
echo "some content" >file.txt
vim file.txt;
echo " Edited the file successfully"
echo "Should we proceed with some task (y/n)"
read input </dev/tty
case $input
y ) do some task
n ) exit
What happens is the file opens I am able to edit the file and after saving the file it executes the echo and then exits.
It gives me an error like this before I am able to edit the file.
Vim: Warning: Input is not from a terminal
Upvotes: 1
Views: 141
Reputation: 780673
If your input is redirected, use:
vim file.txt </dev/tty
to redirect back to the terminal while running vim
.
Upvotes: 2