Run command prompt

Karl Auer kauer at biplane.com.au
Sat Dec 6 23:18:46 UTC 2025


On Sun, 2025-12-07 at 09:20 +1100, Karl Auer wrote:
> On Sat, 2025-12-06 at 17:15 +0000, Jon Cosby via ubuntu-users wrote:
> > > Do you mean like a little terminal window that pops up, you can
> > > enter a command and when the command is finished it disappears
> > > again? I haven't seen that on Ubuntu.
> > 
> > Yeah. That's too bad, it's convenient in launching an application.
> > I'm helping someone with a visual impairment migrate from Windows,
> > and want to avoid the terminal where possible.
> 
> You could probably create a close facsimile using something like
> zenity... A script that pops up a dialogue box, then runs the entered
> command (in a terminal, I guess).

E.g. this script:

#!/bin/sh
CMD=$(zenity --entry --text "Command:" --title="Command prompt")
gnome-terminal -- $CMD

The terminal will stay open until the command finishes. On the flip
side, the terminal will close as soon as the command finishes :-)

If you don't use gnome-terminal, substitute your other terminal
program, passing the command using the appropriate arguments.

Depending on how you run the script, you may find that commands using
redirection don't work as you expect. You might like to use "if [[ -t 0
]] ; then" to see whether your script is already interactive, to avoid
starting a new terminal.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au, he/him)
http://www.biplane.cosm.au/kauer





More information about the ubuntu-users mailing list