Bash files open terminal when opened

This seems like something simple to do but for the life of me I cannot figure out how to do it. I would like all bash (*.sh, *.bash) files to open with a terminal to show their output in.

Super User Asked by Chris Smith on December 31, 2020

1 Answers

One Answer

If you are going to run some script from GUI and be able to see its output you can wrap a target script into your own one. You new script calls terminal->bash->your_script and waits until it finishes and exits. In the script below change ./ to your script name and path.

# Bash Menu Script Example

xterm -e "bash -c "./; exec bash"" &
while [ `pidof xterm` ]
wait `pidof xterm`


According to these close popular answers you need to have two scripts in your case.

If you are going to run some script from GUI and be able to see its output you need to enable it.

From Nautilus:

enter image description here

And them when you click your script you will be asked:

enter image description here

From command line:

gnome-terminal -e command


xterm -e command


konsole -e command


terminal -e command

To make the terminal stay when the command exits:

In konsole there is a --noclose flag.

In xterm, there is a -hold flag.

In gnome-terminal, go to Edit -> Profile Preferences -> Title. Click the Command tab. Select Hold the terminal from the drop-down menu labelled When command exits.

enter image description here

You should create a new profile for that and execute with

gnome-terminal --window-with-profile=NAMEOFTHEPROFILE -e command

Answered by Ruslan Gerasimov on December 31, 2020

Add your own answers!

Related Questions

Ping between subnets fails inconsistently

1  Asked on January 30, 2021 by kaybee


Set shortcut for eyedropper (color picker) in firefox

1  Asked on January 28, 2021 by persijn


Removing GRUB from a dual-boot setup

6  Asked on January 28, 2021 by user3409878


Why would DHCP fail so often on a domestic network?

1  Asked on January 28, 2021 by coli


Executing script only on terminal startup with tmux

0  Asked on January 27, 2021 by gilbertohasnofb


Big Sur Beta 2 and 3 Bluetooth issues

0  Asked on January 27, 2021 by jnbn


What types of Ethernet cables are there?

3  Asked on January 27, 2021


Bing Food & Drink app always crashes

0  Asked on January 27, 2021 by brillydev


Ask a Question

Get help from others!

© 2022 All rights reserved.