Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-18-2016, 03:38 PM   #1
LQ Newbie
Registered: Sep 2016
Posts: 10

Rep: Reputation: Disabled
Can you replace missing characters in the script parameters?

I'd like to set up a script that would launch an app (lets call it "Annoyance" ) and set WM_CLASS for it using xprop command.So it would be something like:

/pathtoannoyance & sleep 10s && xprop -name "window_name" -f WM_CLASS -set WM_CLASS "Annoyance"

The problem is that "window_name" varies, depending what file I open with Annoyance. So when I open file1 the title is "file1-Annoyance", when I open file2 it is "file2-Annoyance" and so on.

Thus I wonder whether it is possible to make xprop look only for the last letters in the window title?

But on the other hand that might cause other problems - if I open a couple of windows and if only the last letters will be used xprop won't know which windows needs to get a WM_CLASS assigned (thinking out loud...).

Any ideas on the solution?
Old 09-19-2016, 12:04 AM   #2
Senior Member
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 2,363
Blog Entries: 3

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
You could pass the window name as a variable instead and modify it before using such that the unwanted characters are removed.

PS. Wrapping your source code in [code] [/code] tags will make it more readable.


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
Script to replace Control characters with a number, if not with Space Sunray74 Linux - Newbie 22 12-16-2014 04:17 PM
Using sed in bash script to serach and replace special characters, and text PoltoX Programming 6 08-14-2013 10:25 PM
Bash script to accept password and replace characters with * as they are typed krisdames Programming 16 10-02-2011 11:22 PM
How do I replace special characters in a string within a bash script? rhaup0317 Linux - Newbie 2 06-03-2008 11:56 AM
How to modify the names of files and replace characters with other characters or symb peter88 Linux - General 2 12-10-2006 03:05 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 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