Return name of running WM in bash?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Return name of running WM in bash?
# 1  
Old 05-14-2009
Return name of running WM in bash?

While I am by habit comfortable with bash as a shell, from time to time, I find tiny reasons to believe it's a little dense. One of the things that proves it is: to date, I have not been able to get it to identify what WM it's running inside of or alongside of in an X11 kind of environment (specifically Cygwin/X).

Is there an "echo" variable already set in bash to get it to barf up this information, or would I have to create a function for one? If the latter, could someone give me a nudge, code-wise, in a fair direction?

Thanks.

BZT
# 2  
Old 05-14-2009

Bash cannot know what window manager is running unless there is an environment variable set by the window manager.

In my environment, I see three variables that contain the name of my WM:

Code:
$ set | grep -i maker
DESKTOP_SESSION=03WindowMaker
GDMSESSION=03WindowMaker
WMAKER_BIN_NAME=/usr/bin/wmaker

If you have no such variables, you can search the output of ps.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to return from background process and check if it is running or not?

Hi Team, i am executing 3 scripts in background from 1 script and i want to send a message once the script gets completed.these scripts usually takes 1 hr to complete. My sample script is below, Vi abc.sh sh /opt/data/Split_1.sh & sh /opt/data/Split_2.sh & sh /opt/data/Split_3.sh & ... (3 Replies)
Discussion started by: raju2016
3 Replies

2. Shell Programming and Scripting

bash - Validating return code 0

Hi All, I am trying a script out that will startup on one of my servers. i wanted to check for RC 0 and if it didnt check out, exit. Typo- This is BASH (Redhat) This isnt working, and this is the best way to do error checking I feel. Heres my erorr ./start: line 25: syntax error near... (2 Replies)
Discussion started by: jeffs42885
2 Replies

3. Shell Programming and Scripting

Losing carriage return (X0D) after running awk command

Hi Forum. I'm running the following awk command to extract the suffix value (pos 38) from the "AM00" record and append to the end of the "AM01" record. awk 'substr($0,13,4)=="AM00" {SUFFIX = substr($0,38,2)} substr($0,13,4)=="AM01" {$0 = $0 SUFFIX} 1' before.txt > after.txt Before.txt:... (2 Replies)
Discussion started by: pchang
2 Replies

4. Shell Programming and Scripting

Looking for a return value weather smartctl is running a (short) selftest or not

Hey guys, I'm kinda stuck here.. I'm trying to write a script, which should start a short selftest via smartctl, for example smartctl -t short /dev/sda and after the test is finished I want it to write the new smartvalues in a logfile. well... Now I need a return value for wether the... (1 Reply)
Discussion started by: phill971
1 Replies

5. Shell Programming and Scripting

Expect in bash to get the return value

cat test.sh #!/bin/sh expect <<- EOF set timeout 5 spawn ssh -o StrictHostKeyChecking=no lyang0@128.224.178.245 -C mkdir -p /tmp expect { "Password:" {send "root\r"} } spawn scp -o StrictHostKeyChecking=no /tmp/1 lyang0@128.224.178.245:/tmp/ ... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

6. Shell Programming and Scripting

Return variable value from a script running in background

I have a script which runs a script in the background. Now the script running in background returns some variable value and i want to catch return value in the parent script. e.g. Parent Script : #!/bin/bash ./Back.sh & pid=$! echo "a=$a" echo "b=$b" echo "d=$((a+b))" wait $pid ... (4 Replies)
Discussion started by: Shaishav Shah
4 Replies

7. Shell Programming and Scripting

Suppressing carriage return in bash alias

I'd like to create an alias that displays my string but leaves my cursor at the end. Not seeing any examples of this. One indirect way might be to preload or stuff the history buffer, so I just hit up arrow. (2 Replies)
Discussion started by: tns1
2 Replies

8. Shell Programming and Scripting

Bash - multiple line carriage return

Hello! I have one strange question - let's say I have a long, multiple-line string displayed on the terminal using echo, and I would like to make a carriage return to the beginning of this string, no to the beginning of the last line - is something like that possible? I would like to be able to... (1 Reply)
Discussion started by: xqwzts
1 Replies

9. Shell Programming and Scripting

return part of a string in bash

Hi, I would like to return the last part of a string in an array of strings in bash. The array contains in each position the content below: and I would like to return only the last part of each string. The correct result would be: How can I do that in bash using AWK?... (7 Replies)
Discussion started by: anishkumarv
7 Replies

10. Shell Programming and Scripting

Return code for parallel running threads

Hi, How to use the return code, for parallel running threads. Ex- grep pattern1 file1 file2 file3 file4 & grep pattern1 file5 file6 file7 file8 & grep pattern1 file9 file10 file11 file12 & return_code=$? if (return_code -eq 0) then echo "pattern found" else echo... (2 Replies)
Discussion started by: jitendriya.dash
2 Replies
Login or Register to Ask a Question