# Shell script works different in KDE vs Terminal

I have a shell script that I created to change the next EFI boot then execute a reboot. If I execute it in a terminal window it works fine, but if I execute it using an Icon in KDE it reboots, but does not change the next efiboot. I have tried setting the Icon to run as root, but that didn't make a difference.

Here is the script

#!/bin/bash
kdialog --title "Reboot to Windows Prompt" --yesno "Are you sure you want to reboot to Windows?";
if [ \$? = 0 ]; then
sudo efibootmgr -n 0
reboot
else
kdialog --msgbox "Reboot aborted by user"
fi


Someone even suggested having a pause between the efibootmgr and the reboot, but that didn't work either.

konsole -e /path/to/your/script.sh
Or if you need the window to stay open for some reason use -noclose
• You can launch konsole in the background using &. The icon command would look like this: konsole -e /path/to/your/script.sh & You might still see the console flash in the foreground on launch and I'm not sure if you can prevent that. – Chad Sheets Nov 3 '16 at 19:54