Calling all Plasma Konsole experts

As part of a script I need something that will change to a specific directory, Launch Konsole, then issue a command.

#!/bin/bash
cd /home/don/Temp
git clone https://github.com/endeavouros-team/PKGBUILDS.git
konsole --noclose -e ls -l

This changes directories, downloads the files, opens a konsole window, and does perform the ls -l command, but it does not give me a prompt or cursor. The window is useless at this point and I have to close the window. I need the konsole window left operational for more commands. namely makepkg.

One site I visited suggested putting a & and the end of the konsole command. It didn’t help.

Pudge

Have you tried this:

konsole -e /bin/bash --rcfile <(echo "ls -l")

Edit :

If you also want .bashrc file to be loaded, cat it before using your command in echo.

konsole -e /bin/bash --rcfile <(cat ~/.bashrc; echo "ls -l")
3 Likes

can use dbus

qdbus org.kde.Klauncher5 /kLauncher exec_blind "/usr/bin/konsole" ""
sleep 1
ID=$(qdbus | grep org.kde.konsole -m1)
qdbus $ID /Sessions/1 sendText "#hello
cd /
ls -l
"
exit 0
1 Like

Deep in my memory, something is saying you cannot cd in a script.

My memory!!!

#!/usr/bin/env bash
#
cd /home/xircon/scripts/
pwd
sleep 3
ls

Works fine, but returns to the original directory.

1 Like

I may have got this wrong - but it sounds like you just want to open a Konsole in a particular location and then want to type in commands in that Konsole. I would lose the -e <blah>
This works for me


[daab@ryzen7 ~]$ (cd /tmp; konsole --noclose) >& /dev/null &
[1] 22466
[daab@ryzen7 ~]$ 
1 Like

What I understand from original post is that they want to open Konsole, run a command and then have Konsole open interactively.

-e is calling to run /bin/bash, which is using a customized rcfile that has the command they want to run on Konsole startup.

Just having Konsole open at a particular location is pretty simple and intuitive indeed. Let’s see what @Pudge wanted :slight_smile:

1 Like

That is exactly correct in what I wanted. However, there doesn’t seem to be a simple straight forward way to do this. In favor of KISS I have done things a little differently.

Thanks to all who replied.

Pudge

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.