I am trying to do this script to work:
#!/bin/bash
win_location=$(cat /boot/grub/grub.cfg | grep 'class windows' | cut -d "'" -f2)
sudo sed -i 's/^'GRUB_DEFAULT='.*$/GRUB_DEFAULT="$win_location"/' /etc/default/grub
sudo update-grub2
But the problem is it does not recognizes the variable, which should be printed between quotes to the file because its value include spaces.
Any idea?
Thank you in advance