LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 03-22-2005, 05:11 PM   #1
bendeco13
Member
 
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
Bendeco

Last edited by bendeco13; 03-22-2005 at 05:13 PM.
 
Old 03-23-2005, 11:50 AM   #2
frankmulder
Member
 
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)



-Frank
 
Old 04-12-2005, 04:29 AM   #3
bendeco13
Member
 
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, 04:46 AM   #4
bendeco13
Member
 
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:
Code:
#!/bin/bash
#
TIMEOUT=5
konsole --script &
SESSION=konsole-$!
TEST=`dcop $SESSION 2>&1 | grep "session-1"`
COUNT=0
while [ ! "$TEST" ];
do
   if [ $COUNT == $TIMEOUT ];
   then
      echo "Timed Out."
      exit 1
   fi
   TEST=`dcop $SESSION 2>&1 | grep "session-1"`
   sleep 1
   COUNT=$(($COUNT + 1))
done
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
 
  


Reply


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 05:31 PM
DCOP error MaicoMedia Linux - Newbie 0 07-25-2004 09:21 AM
DCOP Help pete281 Linux - Newbie 9 07-12-2004 05:58 PM
Dcop chingasman Linux - Newbie 11 05-30-2004 06:51 AM
DCOP problem guygriffiths Linux - Software 0 10-21-2003 10:35 AM


All times are GMT -5. The time now is 04:02 AM.

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