On Wednesday 25 April 2007 09:53, Randall R Schulz wrote:
> ...
>
> On Wednesday 25 April 2007 09:40, Vince Oliver wrote:
> > Hi
> >
> >
> > I would like to put a function into .bashrc file that would open a
> > new Konsole in SUSE10.2 and cd into the result of the pwd command.
> > Something like:
> >
> > pwdinnk() {
> >     p=`pwd`
> >     echo $p
> >     `dcop $KONSOLE_DCOP newSession`
> >     cd $p
> > }
>
> What value does KONSOLE_DCOP have?

After some experimentation, I came up with this:

% KONSOLE_DCOP="$(dcop |egrep konsole-)"

At the moment on my system, that's "konsole-7761". I assume that if no 
Konsole instance is running, KONSOLE_DCOP will be empty and if there 
are multiple instances of Konsole running, then there will be multiple 
konsole-#### values produced. Both of these will be special cases you'd 
have to deal with.


> ...
>
> Furthermore, the backticks around the dcop invocation don't seem to
> make any sense to me. You're telling the shell (the one executing the
> pwdinnk function) to take the output of the dcop command and
> interpret it as a command to execute. I doubt that's what you want,
> is it?

From my experiments, this invocation creates a new Konsole tab:

% dcop $KONSOLE_DCOP konsole newSession
session-13

With "session-13" (with numbers incrementing as new tabs are created, of 
course) being the output of the dcop invocation. Clearly, 
executing "session-13" will have no useful effect, other than to 
produce a diagnostic from the shell:

% `dcop $KONSOLE_DCOP konsole newSession`
bash: session-14: command not found


To the best of my knowledge of dcop (admittedly rather limited), the 
approach I suggested is probably your only real option for passing 
commands to the newly created shell.


Randall Schulz
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to