
How can I also run it with a double click on KDE?

ls -al /home/and/aplicaciones/screenfetchmag.sh
#!/bin/bash
magvariable=”MAG23/11/2019”
echo $magvariable
screenfetch
read -rsp $'Pulsa ENTER para continuar\n'
”MAG23/11/2019”
.°°. and@localhost
°° .°°. OS: Mageia 7 mga7
.°°°. °° Kernel: x86_64 Linux 5.3.11-desktop-1.mga7
. . Uptime: 35m
°°° .°°°. Packages: 2301
.°°°. '___' Shell: bash
.'___' . Resolution: 1920x1080
:dkxc;'. ..,cxkd; DE: KDE 5.57.0 / Plasma 5.15.4
.dkk. kkkkkkkkkk .kkd. WM: KWin
.dkk. ';cloolc;. .kkd GTK Theme: [GTK2/3]
ckk. .kk; CPU: Intel Core i5-7400 @ 4x 3.5GHz [30.0°C]
xO: cOd GPU: EFI
xO: lOd RAM: 2908MiB / 7898MiB
lOO. .OO:
.k00. .00x
.k00; ;00O.
.lO0Kc;,,,,,,;c0KOc.
;d00KKKKKK00d;
.,KKKK,.
Pulsa ENTER para continuar
-rwxrwxr-x 1 and and 129 nov 26 20:13 screenfetchmag.sh*
[Desktop Entry]
Comment[es_ES]=M. A. G.
Comment=M. A. G.
Exec=/home/and/aplicaciones/screenfetchmag.sh
GenericName[es_ES]=Abre screenfetch en una ventana de terminal
GenericName=Abre screenfetch en una ventana de terminal
Icon=konsolekalendar
MimeType=
Name[es_ES]=Enlace a script screenfetch
Name=Enlace a script screenfetch
Path=
StartupNotify=true
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
[doktor5000@Mageia7VM ~]$ cat /home/doktor5000/script.sh
#!/bin/bash
echo this is a script
read -rsp "press ANY key" key
[doktor5000@Mageia7VM ~]$
[doktor5000@Mageia7VM ~]$ cat ~/Desktop/link\ to\ script.desktop
[Desktop Entry]
Comment[en_US]=link to script
Comment=link to script
Exec=/home/doktor5000/script.sh
GenericName[en_US]=link to script
GenericName=link to script
Icon=exec
MimeType=
Name[en_US]=Link to Application
Name=Link to Application
Path=
StartupNotify=true
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=
[doktor5000@Mageia7VM ~]$
[doktor5000@Mageia7VM ~]$ xdg-mime query filetype ~/script.sh
application/x-shellscript
[doktor5000@Mageia7VM ~]$ xdg-mime query default application/x-shellscript
org.gnome.Builder.desktop
[doktor5000@Mageia7VM ~]$
$ xdg-mime query filetype ~/aplicaciones/screenfetchmag.sh
application/x-shellscript
$ xdg-mime query default application/x-shellscript
org.kde.kwrite.desktop
[boinc@home ~]$ ls -l boinc.sh
-rwxr-xr-- 1 boinc boinc 50 Aug 15 2016 boinc.sh*
[boinc@home ~]$ cat boinc.sh
#!/bin/sh
cd "/var/lib/boinc/" && exec boincmgr $@
[boinc@home ~]$
JoesCat wrote:edit: try naming the desktop file something.sh instead of something.desktop (I recall having to do this on and older desktop).
[boinc@home ~]$ cp boinc.sh Desktop/boinc_1.sh
[boinc@home ~]$
[boinc@home ~]$ cd Desktop/
[boinc@home Desktop]$ ln -s ../boinc.sh boinc.sh
[boinc@home Desktop]$ ls -l
total 20
-rwxr-xr-- 1 boinc boinc 50 Nov 29 08:18 boinc_1.sh*
lrwxrwxrwx 1 boinc boinc 11 Nov 29 08:23 boinc.sh -> ../boinc.sh*
-rwxr-xr-x 1 boinc boinc 5932 Oct 20 15:52 org.kde.home.desktop*
-rw-r--r-- 1 boinc boinc 2902 Oct 20 15:52 org.kde.trash.desktop
-rwxr-xr-x 1 boinc boinc 2361 Oct 20 15:52 register.desktop*
[boinc@home Desktop]$
JoesCat wrote:You need to do three things to make it work.
You already did one, which is you named the script ending in .sh
The second thing you need to do is make sure the file is visible to the user, so if the user is "boinc" then the file should be visible to the user "boinc" too. run ls -l and see if the user, group, other settings are set to allow this.
The third thing you need to do is indicate the script is "executable".
So it needs to at minimum be marked x for the user (and group, and other too if you put it in a shareable directory where others can use it too, but not needed for a private user desktop).
I have this setup for boinc.
- Code: Select all
[boinc@home ~]$ ls -l boinc.sh
-rwxr-xr-- 1 boinc boinc 50 Aug 15 2016 boinc.sh*
[boinc@home ~]$ cat boinc.sh
#!/bin/sh
cd "/var/lib/boinc/" && exec boincmgr $@
[boinc@home ~]$
This is probably not important, since your default is probably set to bash, but some environments use sh.
For example cron jobs run at kernel level may likely be sh and not bash, so you may want to convert the bash to sh on your script.
edit: just saw "executable" on permissions, my error.
edit: try naming the desktop file something.sh instead of something.desktop (I recall having to do this on and older desktop).
$ ls -l
-rwxrwxr-x 1 and and 129 nov 26 20:13 screenfetchmag.sh*
JoesCat wrote:
because of using sh instead of bash, Linares example script may need to use:
sh screenfetch
and not
screenfetch
isadora wrote:Would you please mark this topic [SOLVED]?
Users browsing this forum: doktor5000 and 1 guest