Why Xwin. test works in Xterm and not script? [ Solved ]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Why Xwin. test works in Xterm and not script? [ Solved ]

#1 Post by sunburnt »

The file: /tmp/xwin.error is empty when the code is run from a script.
But it works great in Xterm:

Code: Select all

xwininfo -name "$1" 1> /dev/null 2> /tmp/xwin.error
Last edited by sunburnt on Thu 22 Apr 2010, 00:54, edited 1 time in total.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#2 Post by 8-bit »

Routing it through /dev/null basically wipes out the information you are trying to get.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

No it doesn`t, the only thing being run to null is std. out.
Try it... 2> gets the error but outputs a screen full of info ( 1> ) if there`s no error.
So if the Xwin. title is good 1> sends the Xwin. info to the trash to keep the screen clean.

It`s writing the file every time now, but again... It works fine in Xterm but the script errors.

I took my error message out and now it doesn`t error any more... Weird!
The echo command seems to be the problem, it`s returning back to the function call!
But the if statement should end the script with " exit 7 ;fi" after that! But it never gets there!

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

I solved it...
I moved the test out of that function and put it in it`s own function that`s called normally..

It seems running a function while evaluating it means it evaluates everything as it`s being run,
not just evaluating the returned values as you might expect..

The script works great now... I`ll show what I`m doing in a little bit.

Post Reply