How to set DISPLAY env. in script.

  • Permalink
  • submit to reddit
  • Email
  • Follow


How do you set DISPLAY env. using scripting?

# cat /tmp/TMP_DISP
localhost:15.0

------

#!/bin/ksh
#
if [ -f /tmp/TMP_DISP ]
then
    export DISPLAY=`cat /tmp/TMP_DISP`
fi

------

After running the script...

# echo $DISPLAY

#

Thanks,
Mitch J.





0
Reply Mitch 1/30/2007 1:54:30 AM

See related articles to this posting


In comp.unix.solaris Mitch J. <tsmclcenbt@comcast.net> wrote:
> How do you set DISPLAY env. using scripting?

Set it in your .profile, or "source" the script... don't execute it.

When you run a script like an executable program, a new shell gets started
and executes it.  You're only changing the environment of THAT shell.
Once it's done and exits, your original shell is left in exactly the same
shape as when you began.

-- 
Brandon Hume    - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
0
Reply hume 1/30/2007 2:27:35 AM

"Mitch J." <tsmclcenbt@comcast.net> writes:
>
>    export DISPLAY=`cat /tmp/TMP_DISP`
>

As a side note, this is more efficient for reading the contents
of a file into a variable in ksh:

   export DISPLAY=$(< /tmp/TMP_DISP )

It saves the shell forking and exec'ing /usr/bin/cat.

This syntax is documented in the ksh man page, though it isn't
easy to find.  I've tested it on Solaris 7 and later, but I think
it's supported in earlier versions of Solaris too.

  -Greg
-- 
Do NOT reply via e-mail.
Reply in the newsgroup.
0
Reply gerg 1/30/2007 5:46:58 PM
comp.sys.sun.admin 3735 articles. 4 followers. Post

2 Replies
822 Views

Similar Articles

[PageSpeed] 2


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

How to set the message displayed when a Perl Script fails compilation?
Hi all, I'm sure this is glaringly obvious to those in the know, but my efforts to find the answer have failed. My problem is with the message that is displayed in a web browser when a script fails compilation. At the moment I'm getting this: For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error. At least, I'd like to know how to set the email address for the webmaster instead of no address given. Ideally I'd like to handle the failed compilation in some way that would allow me to display a friendly p...

check when display variable is not set using perl scripts
Hi, I need help in perl for writing script to check wheter DISPLAY variable is set or not in unix and also to check whether it is set correctly or not. example : export DISPLAY=XX.xx.xx.xxx Thanks Rajashekar In article <1141904480.142872.186960@v46g2000cwv.googlegroups.com>, rajashekar14@yahoo.com wrote: > Hi, > I need help in perl for writing script to check wheter DISPLAY > variable is set or not in unix and also to check whether it is set > correctly or not. > > example : export DISPLAY=XX.xx.xx.xxx > > Thanks > Rajashekar if (defined($ENV{'DI...

Setting ENV varibles by calling a shell script within a perl program
I need to make some system calls to other programs from a perl program and those programs that are being called have some environment variable dependencies that are set by a shell script program. So I have to call this shell script to set up (export bunch of variables) environment variables so that the other program that I call can run fine. If all possible, I am trying to avoid writing another shell program that call the other shell program prior to my perl program since I have lots of variable combination that my perl program can run with and do not want to have all the variable validated...

Setting env variable in DB2 env
Hi I am trying to set an env. variable by exporting in unix environment on DB2. I am using export var_name=ON, but it is not taking the value of the var_name. This thing is working fine when I am doing it on a simple c++ program and retieving it by using getenv() function. Can anyone help me in getting the solution how to set an env variable in db2 zeeshan In article <1152178679.169636.311910@j8g2000cwa.googlegroups.com>, shaan.shaan@gmail.com says... > Hi > I am trying to set an env. variable by exporting in unix environment on > DB2. > I am using expor...

Algorithm to combine or-sets of and-sets, where each element of an and-set is an or-set of and-sets
As part of an abduction procedure, see http://code.google.com/p/biohacker/source/browse/trunk/BPS/ltms/abduction.lisp if interested, I need to efficiently solve the following problem: Given an or-set of and-sets, for example, (:OR (:AND A B C) (:AND D E A)) and given a dictionary, where each element of an and-set is listed, with another or-set of and-sets as value, for example, A -> (:OR (:AND 1 2) (:AND 3 4)) B -> (:OR (:AND 2 3) (:AND 4)) C -> (:OR (:AND 1) (:AND 3)) D -> (:OR (:AND 1) (:AND 3 4)) E -> (:OR (:AND 1 2) (:AND 3)) find a new minimal or-set of and-set consistent,...

Does a 23" Cinema Display remember display settings?
I am thinking of buying the new 23" monitor, which I will use both on the Mac and PC (until I get rid of the later when Intel-based desktops come out). I play games on both, and I'm curious how the monitor reacts to resolution changes. On any bog-standard monitor, the monitor remembers the display settings based on the input signal. For instance, if you have a game that switches to 1024x762x85Hz, when you set up the display, those settings will automatically load when the game switches to that mode again. When the game exits and returns the machine to 1280x1024x120Hz, the memory kick...

"On UNIX systems, the IDL_IDLBridge requires that the DISPLAY environment variable be set to a valid X Windows display. If no display is available, execution of the IDL_IDLBridge will halt" Wh
Hello All, I have just started using IDL_IDLbridge for analysing my data. It really speeds up things..X7 times for me...now I wanted to run the program which has IDL bridges on a UNIX based cluster. Thats when I am facing this problem. IDL_IDLBridge needs a X window connection ,which we cannot have when using the cluster unless we start an interactive job. Doing that, hinders our chances to make the analysis much faster. So I was just wondering why IDL_IDLbridge need a X window.... or is there a method through which we can bypass this operation. any ideas? Thank You Sajan ...

Displaying record number against number of record displayed in a found set
when viewing a record from a found set I want to be able to display the the record number being viewed against the number of records in the found set. For example " record 2 of 10 found", "record 55 of 72 found". Filemaker already does this in the left hand menu, however I would like to have this displayed in the layout itself. -- Message posted via http://www.dbmonster.com In article <0d64a6fc5bee4c139d0b9ac12276abf8@DBMonster.com>, "Mark Greenwood via DBMonster.com" <forum@nospam.DBMonster.com> wrote: > when viewing a record from a found se...

Display settings
Ok. I have a Dell Latitude CP233 running Win'98SE Problem is it's a 14" display and only 12" of it are there. There's a 1" border around the display. In the setting I have either 16 colors or 2 colors. I can't help but feel I'm missing something in the settings of Windows config. I should get the entire 14" display. And of course better graphics(256?) When I go to F2 for computer setup, it's 14". Any help on what I did wrong and how to correct it? John "John" <jsumma@rgv.rr.com> wrote: >Ok. I have a Dell Latitude CP23...

Init script fails when set to S99, works when set to S22
I have tshark installed on my box and I have an init script that is chmod 755 and chown root.root It is in /etc/init.d/ and rc2.d as S99tshark (symlink to /etc/ init.d/). When the box is started, tshark will not start. But, if I set it to S22tshark (higher priority) it does startup at boot. Can anyone think of a reason why this is the case? tash wrote: > I have tshark installed on my box and I have an init script that is > chmod 755 and chown root.root > > It is in /etc/init.d/ and rc2.d as S99tshark (symlink to /etc/ > init.d/). > > When the box is...

display settings
I connect my Mac Mini (running Tiger) to an old fashioned fat-TV sometimes via s-video. The Mac automatically changes the display settings to 800x600 when I do this, but then I always change it manually to 720x576 (PAL) from the display icon in the menu bar, or the system preferences display tool (because it looks better, you don't need to ask). How can I get it to remember my setting and use it automatically every time? I've looked for a suitable plist file to edit, without success. /gordon -- ...

Set of sets
Is there a Latex (or indeed a mathematical) symbol for 'the set of sets'? Cheers. On Jun 19, 10:43=A0am, "Axis" <zedc...@hotmail.co.uk> wrote: > Is there a Latex (or indeed a mathematical) symbol for 'the set of sets'? > > Cheers. I'm not sure what you mean. I'd write something like B=3D\{A_1,\ldots,A_T\} "Joris" <pinkse@gmail.com> wrote in message news:583b3c5c-a019-4be7-a936-876f06160b05@l28g2000vba.googlegroups.com... On Jun 19, 10:43 am, "Axis" <zedc...@hotmail.co.uk> wrote: > Is there a Latex (...

Displaying script
If I load an external script on my page, is it possible to display the source code of the script on my page as a string? Like I load google maps API script. I can see that the script called calls another script. I would like to make a page that prettyprints that final script that is loaded to my client. Actually I would like to prettyprint jQueary but that is another story. On 10/18/2010 10:09 PM, Esa wrote: > If I load an external script on my page, is it possible to display > the source code of the script on my page as a string? > > Like I load google maps API s...

Script Script
Ever want to try a little script to see if it will work but don't want to go through the hassle of creating a file with #!/bin/bash at the top and making it executable and running it as ./script-name and then deleting it or moving it? You can use the fc command in bash, but it runs in the current shell, which can cause real problems, and once you've done it, if it is more than one line, or you do anything else in between at the prompt, it's gone. fc also echos the script, which is really ugly and confusing. So I wrote this little script which has been tremendously u...

set of sets
I thought rewriting __hash__ should be enough to avoid mutables problem but: class H(set): def __hash__(self) return id(self) s=H() f=set() f.add(s) f.remove(s) the add succeeds the remove fails eventually not calling hash(s). Thanks for help Paolino ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it Paolino wrote: > I thought rewriting __hash__ should be enough to avoid mutables problem > but: > > class H(set): > def __hash__(self) > return id(self) > > s=H() > >...

Setting and more Settings
I have a Epson 4990 and a spyder2 express. The Epson twain configuration allows me to set color control in one of three ways 1. continuous auto exposure. on this option you must set a gamma value from 1.0 to 3.0 (in 0.1 increments) 2. ICM With a source and a target. The source is locked as (EPSON standard) The target has a choice of monitorRGB or sRGB 3. No color correction What would be the best choice for the above options ? Also, given the fact that I am using the spyder2 to load Monitor calibration settings into my video card at windows ...

DICOM Hanging Protocols and image set and display set labels
Just a quick question. The DICOM standard for hanging protocols specify an attribute that allows one to associate a label with an Image Set - this label, I assume, should be rendered in the text overlay by the workstation. Howcome the label is associated with the image set and not the display set? Labeling the display sets makes more sense to me, as more than one display set may use the same image set, e.g for a CT hanging protocol that splits LOCALIZER images into a separate display set - wouldn't it make sense to have different labels for the two display sets in that s...

Display Settings
Hello - We have a FPW 2.6 application. This application needs the screen resolution to be 1024X768 in order for the screens and forms to appear right. Is there any way to manipulate the display settings on a client machine thru the application to change the resolution to this value and set it back to whatever value they had once the user quits the program. Shah Shah, No, and it wouldn't be a good idea to do it anyway. Most people set = their resolution the way they want and it's a bit rude to consider = changing it on them - especially since this affects ALL other...

sets of sets
I'm trying to read a recent paper I found at http://csr.uvic.ca/~vanemden/Publications/STPCS.pdf (The description intrigued me because the author is exploring RT. I'll try to contact the author with my question, but I thought I'd mention it here as others may be interested.) Anyway, at the top of page 5, he defines something I can only call "UNION S" (since I don't know know how to type the set union operator symbol). Can anybody suggest whether I'm reading it right? What I think it says in prose is "the set of x such that x is a member...

where is this display setting?
When I'm running on battery power and don't touch the trackpad or keyboard for a while, three things happen: 1) the screen dims after a couple of minutes; 2) my screensaver starts running a couple minutes later; 3) the display goes to sleep after that. I have found the controls for 2 & 3 in System Prefs -- where can I set #1, the amount of delay before the dimming? In article <140220061625224230%nobody@home.com>, Anonymous <nobody@home.com> wrote: > When I'm running on battery power and don't touch the trackpad or > keyboard for a while, three ...

display settings
anytime i try to get into the fs9 display settings it shuts down. the other tabs work correctly, sound, traffic, etc. it has worked b4. i did a second install to a different file name, it does not work either. dave ...

How to set the default shell to tcsh; how to set the DISPLAY to the IP of the client automatically
Hi I am a newbie to Linux Need to understand the following a)How to set the default shell to tcsh b)How to set the DISPLAY environment variable to the client's IP address that logs into the Linux server. Thanks for any info change the shell for the current user, permanently? use "chsh" - "chsh tcsh" sorry, can't help with the DISPLAY IP question Mark "2pac" <cal_2pac@yahoo.com> a �crit dans le message de news:d04df644.0307072143.25985ca4@posting.google.com... > Hi > I am a newbie to Linux > Need to understand the following > a)How to...

VIEWTABLE: Display Data Set Name Instead of Data Set Label
I'm sorry. I neglected to include the subject for the previous post. Yesterday, in a separate thread "Re: Display manager: show column names instead of labels?", tj_noreply@YAHOO.COM asked: "Thanks for the info on the dataset option. If I forgot to use the option when creating the dataset, is there an option such as tableheading=3DNAME, similar to the colheading=3Dnames in the = viewtable?" As far as I know, SAS doesn't provide a way for end users to make VIEWTABLE display the name when the data set has a label. VIEWTABLE Help does document 2 ways that SAS/AF...

How to display from shell script the "last modified date" of the current script?
Assume I want to display the "last modified (date+) time of the script which is currently running. How can I access this date/time information from within the same script and display it? Karl Karl Medrell <k.medrell@hotmail.com> wrote: > Assume I want to display the "last modified (date+) time of the script > which is currently running. How can I access this date/time information > from within the same script and display it? In the general case you can't reliably do that; someone might have deleted and/or replaced the script shortly after you started running it....