Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-20-2004, 03:35 PM   #1
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Rep: Reputation: 38
Unhappy Bash script problem


If I call my bash script (openfirebird) from commandline it works fine but if I run it my program (kdevelop) it does not work as expected. The if statment is always false and
$FBDIR/MozillaFirebird -remote "xfeDoCommand(openBrowser)" & is called. This givs a error: No running window found.

If i got an instance of the browser it works fine.

Any idees!

The script is simple:


#script by Kent Le (
#written in October, 2003

FBNUM=`ps -A | grep -c MozillaFirebird`
#really freaking ugly hack: counts number of already running instances of firebird
#directory of Firebird directory; modify to your own

if [[ FBNUM -lt 1 ]]
#if no running instances -eq equal -lt less than
$FBDIR/MozillaFirebird &
#otherwise, there is at least one instance of firebird running
$FBDIR/MozillaFirebird -remote "xfeDoCommand(openBrowser)" &
#open a new browser instance

and in the program :
Where the script is openfirebird.

Old 01-20-2004, 03:56 PM   #2
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Re: Bash script problem

Originally posted by kalleanka
if [[ FBNUM -lt 1 ]]
Old 01-30-2004, 11:59 AM   #3
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38

Ok i rewrote the if-statement and now it works fine.

Here is a nice site all hackers should read or should have read.

The Bull of Boolean Types

Any project using source code from many sources knows the pain of multiple conflicting boolean types. The new C++ standard defines a native boolean type. Until all compilers support bool, and existing code is changed to use it, we must still deal with the cruel world.

The form of boolean most accurately matching the new standard is:

typedef int bool;
#define TRUE 1
#define FALSE 0


const int TRUE = 1;
const int FALSE = 0;

Note, the standard defines the names true and false not TRUE and FALSE. The all caps versions are used to not clash if the standard versions are available.

Even with these declarations, do not check a boolean value for equality with 1 (TRUE, YES, etc.); instead test for inequality with 0 (FALSE, NO, etc.). Most functions are guaranteed to return 0 if false, but only non-zero if true. Thus,

if (TRUE == func()) { ...

must be written
if (FALSE != func()) { ...


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
Problem with bash script. cheater1034 Programming 9 11-21-2005 10:29 PM
bash script problem fatbastard spice Linux - General 2 08-24-2005 02:15 AM
bash script problem GATTACA Programming 3 06-13-2005 09:59 AM
bash script problem sorry99 Programming 2 09-20-2004 09:02 AM
Problem with bash script cowardnewbie Programming 1 10-01-2001 06:53 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:41 PM.

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