How do you set DISPLAY env. using scripting?
# cat /tmp/TMP_DISP
if [ -f /tmp/TMP_DISP ]
export DISPLAY=`cat /tmp/TMP_DISP`
After running the script...
# echo $DISPLAY
In comp.unix.solaris Mitch J. <firstname.lastname@example.org> 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/
"Mitch J." <email@example.com> 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.
Do NOT reply via e-mail.
Reply in the newsgroup.