You are not logged in.

#1 2015-09-10 23:15:41

Oblivion7
Member
From: Outside your universe.
Registered: 2015-08-29
Posts: 78

How do i properly use kdialog --yesno

I want this dialog box to pop up asking if i want to upgrade or not but when i say no the command is still executed.
this is my script:

#!/bin/bash

kdialog --title "Scheduled system update" --yesno "System update \
.\n Do you want to update now?"
konsole -e bash -c "sudo tar -cjf /.Backups/Pacman-Db_Backup/pacman-database.tar.bz2 /var/lib/pacman/local && sudo pacman -Syu && sudo sh /home/oblivion/.Scripts/Pacman-Clean.sh"

exit 0

EDIT: I am VERY new at this so if my script makes you want to vomit, i'm sorry. tongue

Last edited by Oblivion7 (2015-09-10 23:17:41)


Anyone who has never made a mistake has never tried anything new. ~Albert Einstein

Offline

#2 2015-09-11 00:28:28

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,806

Re: How do i properly use kdialog --yesno

It probably has a non-zero return value on cancel so check for that:

#!/bin/bash

kdialog --title "Scheduled system update" --yesno "System update \
.\n Do you want to update now?"

if [ $? = 0 ]; then
konsole -e bash -c "sudo tar -cjf /.Backups/Pacman-Db_Backup/pacman-database.tar.bz2 /var/lib/pacman/local && sudo pacman -Syu && sudo sh /home/oblivion/.Scripts/Pacman-Clean.sh"
fi

exit 0

See also: https://techbase.kde.org/Development/Tu … DE_Dialogs

Last edited by V1del (2015-09-11 00:32:22)

Online

Board footer

Powered by FluxBB