LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-22-2005, 06:11 PM   #1
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Rep: Reputation: 30
dcop konsole

I'm trying to use a couple of commands to start konsole with a formatted prompt (PS1).
Heres what I have so far:

konsole --script &
dcop konsole-$! session-1 feedSession "PS1='\033[33;1m[\u \w]\$\033[0m '"

This sends the text ["PS1='\033[33;1m[\u \w]\$\033[0m '"] to the session, but I can't figure out how to emulate an enter from the dcop interface (submit the text).

Does anyone know how to do this?

Thanks In Advance

Last edited by bendeco13; 03-22-2005 at 06:13 PM.
Old 03-23-2005, 12:50 PM   #2
Registered: Jun 2004
Distribution: Kubuntu
Posts: 30

Rep: Reputation: 15
You can also edit ~/.bashrc and insert PS1='\033[33;1m[\u \w]\$\033[0m' there, to change your prompt.

But for your problem:
I managed to do your trick by typing konsole --script &
dcop konsole-$! session-1 feedSession "PS1='\033[33;1m[\u \w]\$\033[0m ', then Enter, and then " and again Enter. (So type an Enter before the last quotes)

Old 04-12-2005, 05:29 AM   #3
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
I understand how that works and I got mine to do the same thing in a similar fashion. I guess I didn't phrase my question in a clear manor.

My problem is that I don't want to have to hit the enter key, but emulate the same affect that the enter key would provide by passing some command that I don't have knowledge of. This would make it possible to add the command to a script.

Thanks for the reply... I hope this clears up my question.
Old 04-12-2005, 05:46 AM   #4
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Sorry about the prior reply, but after playing around with it for a little while.
I realized that you're idea is the correct way to do this.
I just had to add the last double quotation mark (") on a new line.

In a script it would look something like this:
konsole --script &
TEST=`dcop $SESSION 2>&1 | grep "session-1"`
while [ ! "$TEST" ];
   if [ $COUNT == $TIMEOUT ];
      echo "Timed Out."
      exit 1
   TEST=`dcop $SESSION 2>&1 | grep "session-1"`
   sleep 1
   COUNT=$(($COUNT + 1))
dcop konsole-$! session-1 feedSession "PS1='\033[33;1m[\u \w]\$\033[0m '
The while loop ensures that the dcop interface is ready to communicate with before the script actually sends commands.

Thanks again Frankmulder


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dcop phoenix7 Programming 3 10-14-2004 06:31 PM
DCOP error MaicoMedia Linux - Newbie 0 07-25-2004 10:21 AM
DCOP Help pete281 Linux - Newbie 9 07-12-2004 06:58 PM
Dcop chingasman Linux - Newbie 11 05-30-2004 07:51 AM
DCOP problem guygriffiths Linux - Software 0 10-21-2003 11:35 AM

All times are GMT -5. The time now is 05:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration