You are not logged in.

#1 2023-04-11 21:16:16

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Running bash command by default installed terminal

Hello, I'm writing a simple script that should run bash command running a specific subcommand, and I would like that this bash command is run on the installed default terminal. My idea was something similar to:

<terminal executable> -- bash -c "echo 'Hello World' "

Is there a way to implement this? Is it possible to use a method similar to "xdg-open" in order to run the default terminal application?

Offline

#2 2023-04-12 06:37:29

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,344

Re: Running bash command by default installed terminal

There's no standard for the "default" terminal emulator.
Some environments will interpret $TERMINAL but you can't even rely on that.

Of course, since you're writing the invocation, you can use whatever you want and make sure that's exported.

${TERMINAL:-xterm} -e bash -c 'echo foo; sleep 5'

Offline

#3 2023-04-12 13:39:49

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Re: Running bash command by default installed terminal

seth wrote:

There's no standard for the "default" terminal emulator.
Some environments will interpret $TERMINAL but you can't even rely on that.

Of course, since you're writing the invocation, you can use whatever you want and make sure that's exported.

${TERMINAL:-xterm} -e bash -c 'echo foo; sleep 5'

What does "${TERMINAL:-xterm}" do?

Offline

#4 2023-04-12 13:42:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,344

Offline

Board footer

Powered by FluxBB