logo elektroda
logo elektroda
X
logo elektroda

Running the script with the icon on the Ubuntu 16.04 LTS desktop

Lord_Vader_CH 4587 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16211061
    Lord_Vader_CH
    Level 9  
    I warmly welcome. I am a novice Linux user, therefore I am asking more experienced colleagues for understanding and possible help step by step. The problem for most of you will be trivial, so please help ...

    I would like to create a script activator on the desktop that shows connected drives. My script:

    #! / Bin / sh
    sudo fdisk -l


    When you start the console and enter sh filename, the script starts correctly

    I tried to create the activator as follows:

    gnome-desktop-item-edit ~ / Pulpit / --create-new

    The activator configuration window pops up, I select Type Program or run in the console, I provide the path, but unfortunately after trying to run the activator a message appears:

    An error occurred while starting the program

    What am I doing wrong ? I am asking for help and best regards
  • ADVERTISEMENT
  • Helpful post
    #2 16211180
    namok
    Level 25  
    You are trying to run a terminal command in a graphical environment which is not allowed to succeed. You must run a terminal for him. Enter the following command
    Code: Bash
    Log in, to see the code
    if you don't have xterm then install it.
  • ADVERTISEMENT
  • #3 16211213
    Lord_Vader_CH
    Level 9  
    Now my script looks like this. Unfortunately, still the same message Running the script with the icon on the Ubuntu 16.04 LTS desktop
    xterm is installed
  • ADVERTISEMENT
  • Helpful post
    #4 16211330
    dedito
    Level 39  
    It wasn't in the script that you were supposed to write it only in the 'command' field of the activator.
    The script was to remain unchanged, although it is not used in this example.
  • ADVERTISEMENT
  • #5 16211570
    Lord_Vader_CH
    Level 9  
    Thank you very much colleagues for help. It actually works :)
    What if I wanted to go one step further and execute a more complex script? It means

    After running the activator on the desktop:

    1. The xterm console is running
    2. Displays drives with the command fdisk -l
    3. Then I would like to burn the image from the disk to a carrier for example:

    dd if = / home / rafal / Documents / filename.br of = / dev / sdg

    4 The problem is that I would like the script to ask which image to copy e.g. .... Press 1 is name1, press 2 is name_2 etc. ...
    and that you can choose the target drive, i.e. 1 is sda, 2 is sdb etc.

    I am asking for help in carrying out such a script
  • #6 16211583
    dedito
    Level 39  
    Read the case instruction.
    Examples can be found using the search engine.
    And you are already beyond the thread.
  • #7 16211621
    Lord_Vader_CH
    Level 9  
    I wouldn't want to start a new thread. I am asking for help for experienced users, it's really a trivial matter

Topic summary

A novice Linux user seeks assistance in creating a desktop script on Ubuntu 16.04 LTS to display connected drives using the command `sudo fdisk -l`. Initial attempts to run the script directly from a desktop launcher fail, prompting advice to use `xterm -e 'sudo fdisk -l; bash'` to execute the command in a terminal environment. After successfully running the command, the user expresses interest in developing a more complex script that prompts for user input to select disk images and target drives for copying using the `dd` command. Further guidance is suggested to explore existing resources and examples for script development.
Summary generated by the language model.
ADVERTISEMENT