Bug 299107 - khotkeys doesn't honour ENV variables in wrapper scripts
Summary: khotkeys doesn't honour ENV variables in wrapper scripts
Status: RESOLVED WORKSFORME
Alias: None
Product: khotkeys
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-30 13:56 UTC by sphakka
Modified: 2015-10-14 21:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sphakka 2012-04-30 13:56:59 UTC
Hi there,

I want to lunch an app via a wrapper script that feeds in extra ENV variables, but this doesn't work. For instance, with the following script

------------------------------------------------
  #!/bin/sh
  export FOO='bar'
  konsole
------------------------------------------------

triggered by META+ALT+k, a konsole pops up, but

  $ echo $FOO

shows nothing.
Launching the same script directly from a konsole's command line works as expected:

  $ echo $FOO
  bar

Cheers,

  ^s


Reproducible: Always

Steps to Reproduce:
1. Write a wrapper shell script with an "export FOO=bar; <app-path>"
2. configure a khotkeys' trigger to launch the above wrapper
3. exercise the trigger
Actual Results:  
The $FOO variable is empty.

Expected Results:  
The $FOO variable should be set with 'bar'.

Possible related Bug 76917
Comment 1 Christoph Feck 2012-05-05 13:43:50 UTC
Could you try "konsole --nofork", or a program which does not use KUniqueApplication?
Comment 2 sphakka 2012-05-05 15:09:26 UTC
Tried, no luck. With '--nofork', khotkeys seems to refuse to run the command -- nothing happens.
Comment 3 Thomas Lübking 2015-10-13 22:42:01 UTC
> #!/bin/sh
> export FOO='bar'
> konsole

bashism.
I assume the krun shell interpreter is used by khotkeys where this won't work.
=> Can you try whether assigning "env FOO=bar konsole" works for you?
Comment 4 Thomas Lübking 2015-10-14 21:39:56 UTC
No problem here.
I will claim that  this depends on what /bin/sh (which indeed is used for interpretation) actually is.
Eg. bash/dash/whatnotsh show different behavior depending on the interactive mode or what $TERM is when invoked.

=> To be sure, operate on the "env" wrapper, otherwise check the setup of your shell interpreter (you may ask for help, if required)