I made a bash script which takes an input form the user:

# mnthere - mounts virtual box share in current working directory
echo Enter the source share name:
readline NAME
sudo -- mount -t vboxsf -o rw,uid=1000,gid=1000 $NAME $0

But when I double-click it, nothing happens. It executes in background probably failing with an error. I need to configure it to show that window, how do I do that? Is that related to XFCE4 desktop environment I am using?

3 Answers 3


If you don't want to modify the launcher, you can check at the beginning of the script whether it is being executed in a terminal. If it isn't, open a terminal and restart the script there. At the top of the script:

if [ ! -t 1 ]; then
    for arg in "$@"; do
        args="$args \"${arg//\"/\\\"}\""
    xfce4-terminal -e "$0 $args"
    exit 0

Then if there is any terminal output to display to the user, add this to the bottom:

read -n1 -u1 -rp 'Press any key to close this window.'

Launch an xterm running your script instead of just running your script and add a read command for instance to stop the output and be able to read.

gnome-terminal -x your_script

  • In other words, double clicking the bash file just does never spawn the console window? Commented Oct 1, 2015 at 9:12
  • Right, it will execute but it won't have an Xwindow container.
    – YoMismo
    Commented Oct 1, 2015 at 9:15

If you edit the launcher (right-click, select Properties, then click on the edit button), one of the options will be a check-box "Run in terminal".

Check that and your script will now run in a terminal.

  • There's no such option in my xfce. Or maybe I am just not sure what do you refer to as "launcher". Commented Oct 1, 2015 at 11:56
  • how do you "click on it" - did you make a launcher icon on the desktop, or from within Thunar or some other file browser. If the latter, I don't think there's any way to do what i said (except right-click, Send To -> Desktop to make a desktop icon). If the former, then it's both easy and obvious.
    – cas
    Commented Oct 1, 2015 at 22:56
  • but my specific instructions were mistakenly for a panel icon. For a desktop icon, it's right-click, select Properties, and then select the Launcher tab.
    – cas
    Commented Oct 1, 2015 at 22:57
  • It's not here. Are you talking about xfce or Ubuntu? image Commented Oct 2, 2015 at 7:28
  • xfce. v4.12.1 on debian sid, to be precise. other versions may vary.
    – cas
    Commented Oct 2, 2015 at 7:29

You must log in to answer this question.

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