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 3734 articles. 4 followers. Post

2 Replies
791 Views

Similar Articles

[PageSpeed] 20


  • 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...

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 -- ...

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...

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...

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....

Re: VIEWTABLE: Display Data Set Name Instead of Data Set Label
Well AF/FSP are not available to me. Here is my work-around - delete all dataset labels in the WORK library. Put this little macro either inside your SASAUTO lib path or inside your autoexec.sas: %macro Del_TabLabels; %global modify_tables ; proc sql noprint; select "modify " ||trim(memname)||"(label=' ')" into :modify_tables separated by "; " from sashelp.vtable where libname='WORK' and memtype='DATA' ; quit; proc datasets library=WORK nolist; &modify_tables ;; run; quit; %mend Del_TabLabels; Then yo...

Script-generated code displaying differntly than the exact same code displayed staticly... help!?!?!
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file (that part's not here -- spotlighting the problem code): --------BEGIN CODE PAGE------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Test</title> <script type="text/javascript"> function testSpans(sbody) { var sp, i...

how to read/set the display card's gamma table and whitepoint/temperature settings?
Dear all talented gurus, I am not a device guy but I really need to your help on programming the display card. Does any know how to read out the display card's gamma table value? and its temperature(whitepoint)value? Thank you vry muych, -Lucy networm schrieb: > Dear all talented gurus, > > I am not a device guy but I really need to your help on programming the > display card. > > Does any know how to read out the display card's gamma table value? and its > temperature(whitepoint)value? No display cards provide to read or write a gamma table. Only printe...

Re: VIEWTABLE: Display Data Set Name Instead of Data Set Label #2
I haven't followed this discussion from the other thread to this one very closely because I don't use VT much. However my limited testing just now indicates that the SAS system option NOLABEL is "honored" by VT. I can turn it off(NOLABEL) to see variable names or on(LABEL) to see labels. I can even VT the same table in two different VTs open at the same time one with labels the other without. On 10/5/07, T J <tj_noreply@yahoo.com> wrote: > Well AF/FSP are not available to me. Here is my work-around - delete all > dataset labels in the WORK library. > > ...

Re: VIEWTABLE: Display Data Set Name Instead of Data Set Label #4
Your are correct. I did not understand. I was think VARIABLE labels not data set labels. On 10/5/07, Randy Herbison <RandyHerbison@westat.com> wrote: > Using the NOLABEL system option would seem preferable to deleting data > set labels. Combining it with a GSUBMIT command would allow one to use > it almost as conveniently as actual VT command line options. > > But I may be missing something here. NOLABEL doesn't seem to affect my > VT session. I still see data set labels when the system option is set > to NOLABEL. I'm using SAS 9.1.3 Service Pack 4 on ...

Re: VIEWTABLE: Display Data Set Name Instead of Data Set Label #3
Using the NOLABEL system option would seem preferable to deleting data set labels. Combining it with a GSUBMIT command would allow one to use it almost as conveniently as actual VT command line options. But I may be missing something here. NOLABEL doesn't seem to affect my VT session. I still see data set labels when the system option is set to NOLABEL. I'm using SAS 9.1.3 Service Pack 4 on XP_Pro -Randy The NOLABEL system option doesn't seem to have an effect when I use VT. I still see the data set label. -----Original Message----- From: owner-sas-l@listserv.uga.edu [mail...