This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Passing a "property" to a sub-konsole

Tags: konsole konsole konsole
(comma "," separated)
Ofnuts
Registered Member
Posts
62
Karma
0
OS

Passing a "property" to a sub-konsole

Mon Feb 14, 2011 10:57 pm
I want to start another terminal and set an environment variable for it. The help for konsole documents passing "properties" but this doesn't seem to work:

Code: Select all
konsole -hold  -p FOO=bar -e printenv


FOO doesn't appear in the output. So how do these properties work?

Using KDE 4.4.5 (Kubuntu 10.04)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Properties belong to Konsole Profiles. Fortunately, this feature is possible. Try:
Code: Select all
konsole -p Environment=TEST=abc


If you need to supply more than one variable, do it as follows:
Code: Select all
konsole -p "Environment=VAR1=Content,VAR2=Bar"


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Ofnuts
Registered Member
Posts
62
Karma
0
OS
Excellent... works as advertised. Thanks a lot.
User avatar
JanGerrit
Moderator
Posts
647
Karma
3
OS
If the topic is solved please use the green hook to mark it as solved. Thanks.


Image
Ofnuts
Registered Member
Posts
62
Karma
0
OS
JanGerrit wrote:If the topic is solved please use the green hook to mark it as solved. Thanks.


Caught a couple of small flies in the ointment... so for the benefit of future readers:

1) if the command (-e) isn't in the default path the started shell won't find it, so you have to give it full path (`which foo`), or you may have to use another profile with a more complete path.

2) I can't find the proper syntax to pass several environment variables as indicated, the comma doesn't seem to act as a separator, even escaped.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
According to the storage of environment variables in the configuration file, a comma is the correct seperator...

Code: Select all
Environment=TERM=xterm,EDITOR=vim


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Ofnuts
Registered Member
Posts
62
Karma
0
OS
bcooksley wrote:According to the storage of environment variables in the configuration file, a comma is the correct seperator...

Code: Select all
Environment=TERM=xterm,EDITOR=vim

Experimentation with
Code: Select all
konsole -hold -p Environment=FOO=foo,BAR=bar -e printenv

shows otherwise (shortened...):
Code: Select all
WINDOWID=77594663
XDM_MANAGED=method=classic
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
FOO=foo,BAR=bar
KDE_SESSION_UID=1000
SSH_AGENT_PID=1651
TERM=xterm
SHELL=/bin/bash

also tried:
Code: Select all
konsole -hold -p Environment=FOO=foo,,BAR=bar -e printenv
konsole -hold -p Environment=FOO=foo\,BAR=bar -e printenv
konsole -hold -p Environment=FOO=foo -p Environment=BAR=bar -e printenv
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I would suggest filing a feature request or bug report at bugs.kde.org regarding this.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell