LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-07-2003, 11:53 AM   #1
BalaclavaBoB
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.

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

Rep: Reputation: 30
Try

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 01:11 PM.
 
  


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 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 03:07 PM
How do I put my entire system into "root", not just the konsole? GameGuru Linux - Newbie 11 07-04-2005 01:21 PM
konsole colors lost when "su" murray_linux Slackware 11 12-10-2004 09:22 AM
konsole problem: "Unable to open a suitable terminal device" Mistreated Linux - Software 2 11-15-2004 03:24 PM
how to "fix" konsole on screen? eradrix Linux - Newbie 1 05-19-2004 06:28 PM


All times are GMT -5. The time now is 11:52 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration