Thank you. I wouldn't be able to do it without your help.
I'll describe what I was doing.
1) Write in Mousepad:
Code: Select all
#!/bin/bash
sudo apt-get update
sudo apt-get dist-upgrade
sudo snap refresh
read line
2) Save it is as updater.sh in /home/user/bin
3)
chmod +x it
4) Write in Mousepad:
Code: Select all
[Desktop Entry]
Name=Update
Exec=bash /home/user/bin/updater.sh
Terminal=true
Type=Application
5) Save it as Update.desktop on desktop
6)
chmod +x it
When I click on the shortcut the terminal opens, sudo asks me for password, after giving sudo password I see terminal's rock 'n' roll and when this rock 'n' roll ends I press enter and terminal disappears (the effect of
read line).
Again, thank you. I'm going to mark the thread as solved, but If I've done something wrong or if there are other solutions to my problem, please point it out.
EDIT:
Just for clarification. The following code in Update.desktop is obviously enough:
Code: Select all
[Desktop Entry]
Name=Update
Exec=/home/user/bin/updater.sh
Terminal=true
Type=Application
I've added
bash, but it seems that it's unnecessary, however unharmful. I've added
bash and rewritten
Exec line from scratch, but now I realised that I had just mistyped
Exec line. Consequently, adding
bash was a superfluum. Only the typo in
Exec line caused the error in executing commands written in updater.sh.
EDIT 2:
I even noticed that
#!/bin/bash is also a superfluum. The following code in updater.sh is enough:
Code: Select all
sudo apt-get update
sudo apt-get dist-upgrade
sudo snap refresh
read line
It still does its job.