1

I was trying to open a new konsole terminal and source file after opening it. I tried the following command:

konsole -T hello --noclose -e "source file"

I wanted the terminal to remain open after sourcing the file but even with --noclose the new konsole closes. How can I keep the konsole remain open

3
  • Can you write more details? which distro? "source file" is a script? in my tests, apart of inexistent T option, the konsole remains open
    – LilloX
    Commented Nov 3, 2015 at 14:48
  • I am running on RedHat and the problem is independent of the command I use in the -e option. Even if I just use cd or ls command, the problem persists.
    – sarthak
    Commented Nov 3, 2015 at 15:21
  • I think maybe a bug in RH... I tried in ubuntu and in arch linux and in both cases konsole remains open... can you try upgrade konsole?
    – LilloX
    Commented Nov 3, 2015 at 15:44

1 Answer 1

0

I guess you want interactive session after running source file.

konsole uses system() or popen() calls to execute -e parameter. source is a bash builtin so you can't just call it.

It is difficult to tell bash to launch commands and then start an interactive session. There is --init-file and --rc-file options but they will be used instead of your usual configuration files. It is may be inconvenient.

I think this shell script will work for you.

#!/usr/bin/env bash
source file
exec bash    

Put it in the file "script.sh", make it executable and launch that way

# Edit script.sh
chmod +x script.sh
konsole -e ./script.sh

I guess you set some variables in your file. It should be exported if it used in interactive session.

export VAR=value

Or if you do not need interactive session you can use this script

#!/usr/bin/env bash
source file
echo "Press enter to exit"
read   

Well. There might be a bug in konsole too. Probably we should report it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .