When I run a bash script with right click → «Run In Konsole» I can’t enter other commands in the terminal. How can fix it?
Screenshots:
When I run a bash script with right click → «Run In Konsole» I can’t enter other commands in the terminal. How can fix it?
Screenshots:
I don’t think is currently possible to make Konsole behave like that after using the -e
argument to run other things (what “Run in Konsole” action does under the hood). I don’t know why it doesn’t return to the shell by default but sounds like a reasonable feature to me. Can you file a bug report about this for konsole?
As a workaround you can edit the service menu in /usr/share/kio/servicemenus/konsolerun.desktop
and replace the line
Exec=konsole --hold -e %f
with
Exec=konsole --hold -e sh -c '%f; $SHELL'
That should start your default shell after the script/executable finishes.
Note that this file will be overwritten when konsole updates so consider making a copy in ~/.local/share/kio/servicemenus/
and maybe with a different name so you can preserve the default one
You could run bash at the end of the script.
Here with Konsole Version 22.12.3 and Dolphin Version 22.12.3
It seems to be a default behaviour of Konsole – if you type [Shift+Ctrl+T] a new Konsole Tab should appear where you can continue a Bash session.
The question remains, what happened to the process where the Bash script was executing?
You can try to track it down as follows:
> ps -C dolphin
PID TTY TIME CMD
11703 ? 00:00:01 dolphin
18471 ? 00:00:12 dolphin
>
> pstree --show-pids 11703
dolphin(11703)─┬─{dolphin}(11705)
├─{dolphin}(11706)
├─{dolphin}(11707)
├─{dolphin}(11708)
├─{dolphin}(11709)
└─{dolphin}(11710)
>
> pstree --show-pids 18471
dolphin(18471)─┬─konsole(19596)─┬─bash(19632)
│ ├─bash(19941)───man(20431)───less(20447)
│ ├─bash(20453)───pstree(21368)
│ ├─bash(20786)───man(20814)───less(20829)
│ ├─bash(20839)
│ ├─{konsole}(19597)
│ ├─{konsole}(19598)
│ ├─{konsole}(19599)
│ ├─{konsole}(19600)
│ ├─{konsole}(19601)
│ ├─{konsole}(19602)
│ └─{konsole}(20240)
├─{dolphin}(18473)
├─{dolphin}(18474)
├─{dolphin}(18475)
├─{dolphin}(18476)
├─{dolphin}(18477)
├─{dolphin}(18478)
├─{dolphin}(18480)
├─{dolphin}(18485)
├─{dolphin}(20245)
└─{dolphin}(20260)
>
You can then try to track down the Zombie process, if it exists at all – <https://itsfoss.com/kill-zombie-process-linux/>
konsole runs a shell if you don’t tell it something to run, but otherwise runs what you tell it to. Terminal emulators have been working like this for decades…