Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-07-2003, 12:53 PM   #1
LQ Newbie
Registered: Sep 2003
Posts: 5

Rep: Reputation: 0
Question konsole: "there can be only one"

Hello, (Hope my Highlander quote is correct... )

I'd like to make a script (will be executed from the K bar) which checks whether konsole is already running, if it is it creates a new tab using:

dcop `dcop|grep konsole|head -n 1` default newSession

(I'd like to thank 'grepper' from irc for this)
otherwise it opens a new konsole.
I don't know how to use what grep returns if it doesn't find anything.

Balalclava BoB
Old 09-07-2003, 02:07 PM   #2
Registered: Aug 2003
Location: Edinburgh, Scotland
Distribution: Gentoo
Posts: 246

Rep: Reputation: 30

dcop | grep konsole && dcop `dcop|grep konsole|head -n 1` default newSession || konsole &

&& means execute next command if last command successful (returned 0)
|| means execute next command if last command unsuccessful (returned nonzero)

grep returns 0 if it finds the string anywhere however returns nonzero if it couldn't find the string. It was therefore possible to build up an if..then..else type construct. (note: || then && doesn't work)

Last edited by nhs; 09-07-2003 at 02:11 PM.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 04:07 PM
How do I put my entire system into "root", not just the konsole? GameGuru Linux - Newbie 11 07-04-2005 02:21 PM
konsole colors lost when "su" murray_linux Slackware 11 12-10-2004 10:22 AM
konsole problem: "Unable to open a suitable terminal device" Mistreated Linux - Software 2 11-15-2004 04:24 PM
how to "fix" konsole on screen? eradrix Linux - Newbie 1 05-19-2004 07:28 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:35 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
Open Source Consulting | Domain Registration