Register
It is currently Tue Sep 16, 2014 9:27 pm

string extraction with erminal command xwininfo


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Apr 17, 2014 2:21 pm   

Joined: Thu Apr 17, 2014 2:18 pm
Posts: 1
Can someone please spot the error in my code?

Code:
#!/bin/bash

#desktop recording script

echo " Choose a Window that is open to get it's window id."
read

StrXwininfo=`xwininfo | grep "xwininfo: Window id: "`
echo ${StrXwininfo:21:9} > /Downloads/scripts/xwininfo.txt
##`xwininfo | grep "xwininfo: Window id: "` > /Downloads/scripts/xwininfo.txt



My output is
Code:
{xwininfo: Window id: 0x3606c4d "record-desktop.sh (/Downloads/scripts) - gedit":21:9}


All I want in the txt file is the octal number.


Top
 Profile  
 PostPosted: Thu Apr 17, 2014 8:34 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 546
hi,

Code:
strX=$(xwininfo | grep -Po 'Window id: \K[^ ]*')
done!

I don't know what's happening with your variable expansion.
how do you execute your script?


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP