I created an automated install script and while executing from the chroot I would like to uncomment the wheel group line. I could do it using sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /etc/sudoers
but I read that is not the best practice. So, how to do it with vim?
The command is :82 s/# //
I tried to use pipe, redirect stdin or use vim +" command file" but the former ones do not work and the latter one works but indicates that it is a readonly file...
Thank you!
One possibility would be to pipe the output of your sed command (without the
-i
flag) into this script to overwrite the sudoers file if it is safe to do so, without having to try to run the editor non-interactively.