Results 1 to 5 of 5

Thread: Shell Script with curl works on terminal but not as menu launcher.

  1. #1
    Join Date
    Nov 2011
    Location
    Portugal - Chaves
    Beans
    294
    Distro
    Lubuntu 14.04 Trusty Tahr

    Shell Script with curl works on terminal but not as menu launcher.

    Hello friends I have a question that at this time I can't find the solution about why this script work if I put the command path in terminal but dont work when I try to launch as launcher menu.

    I also put this same question on this forum but we cant find a solution → https://www.linuxquestions.org/quest...er-4175667112/

    The scritp is a simple script that I use to see weather directly on terminal and I use curl command to connect to the wttr.in service and put the data of weather on terminal.

    This is the script →

    Code:
    #!/usr/bin/env bash curl https://wttr.in/chaves
    I put this code script on a file in one path → /home/joao/.config/tempo.sh

    If I launch it directly on terminal (open lxterminal and put /home/joao/.config/tempo.sh) he works

    But when put this as a launcher on menu when I click on th icon menu only opens the terminal and do nothing.

    I already try many combinations of code in the launcher file and never works.

    Example →

    Code:
    [Desktop Entry]Name=tempo
    Exec=bash -c /home/joao/.config/tempo.sh
    Comment=
    Icon=
    NoDisplay=false
    Type=Application
    Terminal=true
    Categories=Utility;
    Code:
    [Desktop Entry]Name=tempo
    Exec=lxterminal -x sh -c "/home/joao/.config/tempo.sh; read foo"
    Comment=
    Icon=
    NoDisplay=false
    Type=Application
    Terminal=true
    Categories=Utility;
    I already see permissions to execute and read file etc ...

    Never works.

    Thaks for any help.
    Ubuntu with me & me with Ubuntu! my GNU/Linux https://wiki.ubuntu.com/DerivativeTe.../Flavitu-Linux

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    20,973
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Shell Script with curl works on terminal but not as menu launcher.

    Try
    Code:
    #!/bin/bash 
    /usr/bin/curl   https://wttr.in/chaves
    Would be smart to specify the exact output directory+filename. i don't use curl enough to know the options by heart. You can look them up as easily as I can.

    In script, always fully specify the full-path to any commands. Always.

    The first line of a script requires a special format. Any beginning Linux book will explain that. Here's one: http://linuxcommand.org/tlcl.php

    I know zero about newer Lubuntu and less about .desktop files. I did use LXDE on 14.04. Probably should ask the LUbuntu distro people any specific questions about that based on the exact release you run. After 18.04, they changed from LXDE to LXQt. https://lubuntu.net/

  3. #3
    Join Date
    Nov 2011
    Location
    Portugal - Chaves
    Beans
    294
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: Shell Script with curl works on terminal but not as menu launcher.

    Dont work, thanks for your help.
    Ubuntu with me & me with Ubuntu! my GNU/Linux https://wiki.ubuntu.com/DerivativeTe.../Flavitu-Linux

  4. #4
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    7,897
    Distro
    Kubuntu 18.04 Bionic Beaver

    Re: Shell Script with curl works on terminal but not as menu launcher.

    You don't need to launch an additional terminal or shell. Just using Terminal=true is sufficient. You would need something to keep the terminal open so you can see the output.

    This works fine:

    Code:
    #!/bin/bash 
    /usr/bin/curl https://wttr.in/chaves
    read
    Code:
    [Desktop Entry]
    Name=tempo
    Exec=/home/joao/.config/tempo.sh
    Type=Application
    Terminal=true
    None but ourselves can free our minds

  5. #5
    Join Date
    Nov 2011
    Location
    Portugal - Chaves
    Beans
    294
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: Shell Script with curl works on terminal but not as menu launcher.

    I already try this →

    #!/bin/bash /usr/bin/curl "https://wttr.in/chaves"
    read -p "Press any key to continue"
    [Desktop Entry]Name=tempo
    Exec=lxterminal --command="/bin/bash --init-file /home/joao/.config/tempo.sh"
    Comment=
    Icon=
    NoDisplay=false
    Type=Application
    Terminal=true
    Categories=Utility;

    O this line (Exec=lxterminal --command="/bin/bash --init-file /home/joao/.config/tempo.sh") and in the script I also try different types of command and changes and nothing work. The terminal simply open and do nothing. I have help in ther forums of other users and they comment to e that the command and script works well on their systems with other terminals like in Gnome, the problem can be caused by lxterminal so im investigate on lxterminal docs.
    Ubuntu with me & me with Ubuntu! my GNU/Linux https://wiki.ubuntu.com/DerivativeTe.../Flavitu-Linux

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •