1

Is there a way to hide terminal when a bash script for zenity is executed

eg:

szAnswer=$(zenity --entry --text "where are you?" --entry-text "at home"); echo $szAnswer

I want to hide the terminal and only gui-zenity should be visible while executing by double click

4
  • How is this script executed when double-clicking? Or on what do you click?
    – s3lph
    Jun 12, 2015 at 0:05
  • I have saved the script as zen.sh its executing without any problem. The problem is when executing the script (double click) terminal also runs with the GUI. I want to prevent this, i want only GUI to run
    – potholiday
    Jun 12, 2015 at 0:17
  • Does the first line of the script say #!/bin/bash? If not, add it.
    – s3lph
    Jun 12, 2015 at 7:07
  • @the_Seppi yes i have added #!/bin/bash
    – potholiday
    Jun 12, 2015 at 10:17

1 Answer 1

5

To launch a script without the terminal visible, use a .desktop file.

  1. Create a file zen.desktop
  2. Put in the contents of the file using gedit or you favorite text editor(terminal=false will make sure it doesn't show the terminal, although this option should default):

    [Desktop Entry]
    Type=Application
    Terminal=false
    Name=zenity-app
    Exec=/home/user/zen.sh
    

    Replace Exec with where your script is located.

  3. Make sure to set the permission to execute on the .desktop file (and your script) - How to make a file (e.g. a .sh script) executable, so it can be run from terminal
  4. Double click the desktop file and see if it works.
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .