Sponsored Content
Special Forums Windows & DOS: Issues & Discussions How to automatically set the DISPLAY var? Post 302900698 by ejianu on Thursday 8th of May 2014 08:35:41 AM
Old 05-08-2014
How to automatically set the DISPLAY var?

Hi all,

Our users use Putty on Windows servers to log on to UNIX via SSH and run GUI applications. Is there a way to automatically get the display numbers from xming or Exceed (that are running on Windows) to set the DISPLAY var properly on UNIX? X11 forwarding is not an option.

The closest I came to this was to get rid of the hostname with the following:

Code:
display(){
export MYTERM=$(who am i | awk '{print $2}')
export DISPLAY=$(who -u -m | grep $MYTERM | awk '{print $8}' | sed 's/[()]//g'):$1.$2
echo "DISPLAY="$DISPLAY
}

Then run it like this:

Code:
display n m

...where n and m are the Exceed or xming display numbers.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

set display

Hi All: An elementary Unix Question, How can i set the display number and run a program in that display. If i type the name of the executable the program opens in the console(display number 0), however, i want it to open in another display number. How can i do that. Appreciate the help... (2 Replies)
Discussion started by: preetham
2 Replies

2. Shell Programming and Scripting

Difference between "set $<var>" and "set -- $<var>"

Hi pros, Could anyone tell me the actual difference between setting the positional parameters from the variable using the following commands? $ var="This is my question" $ set $var $ echo $1 --> 'This' $ echo $2 --> 'is' .... .... and $ var="This is my question" $ set --... (3 Replies)
Discussion started by: royalibrahim
3 Replies

3. Shell Programming and Scripting

How to set delete Key to erase automatically

We need to su to root in 1000 systems, so it is almost impossible to add "stty erase ^H" to every .profile on these systems. Is there any way to set delete key to erase automatically after running "su -"? Thanks :) (4 Replies)
Discussion started by: aixlover
4 Replies

4. UNIX for Advanced & Expert Users

Set ACL automatically for new folder/objects

Hi, In our bank production environment - IBM AIX 5.3, we have a particular parent folder inside which an application creates temporary folders & files. These temp folders exist for the lifetime of the user session within the application and then get deleted automatically. Since these temp... (1 Reply)
Discussion started by: deepaksinbox
1 Replies

5. Shell Programming and Scripting

assign var with set=a[5] not working

Hi Experts, I'm having issue in assigning var with special character , please see below for complete details. $ echo $SHELL /bin/csh $ cat bp abd/asd/a $ awk -F "/" '{print $NF}' bp | awk '{print $1}' a $ set a=`awk -F "/" '{print $NF}' bp | awk '{print $1}'` $ echo $a ... (15 Replies)
Discussion started by: novice_man
15 Replies

6. Solaris

Set display to text

How do I set up my solaris 10 machine to display in text mode instead of graphics mode, permanently? (1 Reply)
Discussion started by: jastanle84
1 Replies

7. Shell Programming and Scripting

Need a script for automatically cleaning up /var/spool/cups directory

Hi Friends, Actually in an linux server , there was printer jobs files occupying more space in /var/spool/cups so i want a script for deleting the files once in two week since i need the latest two weeks files. Thanks in advance..Waiting for the script. (2 Replies)
Discussion started by: Mohamed Thamim
2 Replies

8. Shell Programming and Scripting

Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have ) so i found out i can't do : set string_buff = "" foreach line("`cat $source_dir/$f`") $string_buff = string_buff $line end how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies

9. Solaris

DISPLAY not set

Hi, When i invoke DBCA as oracle user , i get following usircd01:KAM:/opt/oracle10/product/10.2.0/bin>./dbca DISPLAY not set. Set DISPLAY environment variable, then re-run. usircd01:KAM:/opt/oracle10/product/10.2.0/bin>echo $ORACLE_SID CCE ... (6 Replies)
Discussion started by: Maddy123
6 Replies
WHO(1)							    BSD General Commands Manual 						    WHO(1)

NAME
who -- display who is on the system SYNOPSIS
who [-abHmqsTu] [am I] [file] DESCRIPTION
The who utility displays information about currently logged in users. By default, this includes the login name, tty name, date and time of login and remote hostname if not local. The options are as follows: -a Equivalent to -bTu, with the exception that output is not restricted to the time and date of the last system reboot. -b Write the time and date of the last system reboot. -H Write column headings above the output. -m Show information about the terminal attached to standard input only. -q ``Quick mode'': List the names and number of logged in users in columns. All other command line options are ignored. -s Show the name, line and time fields only. This is the default. -T Indicate whether each user is accepting messages. One of the following characters is written: + User is accepting messages. - User is not accepting messages. ? An error occurred. -u Show idle time for each user in hours and minutes as hh:mm, '.' if the user has been idle less than a minute, and ``old'' if the user has been idle more than 24 hours. am I Equivalent to -m. By default, who gathers information from the file /var/run/utx.active. An alternate file may be specified which is usually /var/log/utx.log (or /var/log/utx.log.[0-6] depending on site policy as utx.log can grow quite large and daily versions may or may not be kept around after compression by ac(8)). The utx.log file contains a record of every login, logout, crash, shutdown and date change since utx.log was last truncated or created. If /var/log/utx.log is being used as the file, the user name may be empty or one of the special characters '|', '}' and '~'. Logouts produce an output line without any user name. For more information on the special characters, see getutxent(3). ENVIRONMENT
The COLUMNS, LANG, LC_ALL and LC_TIME environment variables affect the execution of who as described in environ(7). FILES
/var/run/utx.active /var/log/utx.log /var/log/utx.log.[0-6] EXIT STATUS
The who utility exits 0 on success, and >0 if an error occurs. SEE ALSO
last(1), users(1), w(1), getutxent(3) STANDARDS
The who utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A who command appeared in Version 1 AT&T UNIX. BSD
February 11, 2012 BSD
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy