[SunHELP] $DISPLAY for root

Ben Ricker sunhelp at sunhelp.org
Fri Aug 17 09:17:48 CDT 2001


You do not execute a .profile, you use the command 'source'. Read up on
man source.

Ben Ricker
System Administrator
Wellinx.com

On 17 Aug 2001 07:09:55 -0700, David Baldwin wrote:
> I threw that snip in my /etc/profile but when I ". /etc/profile" I get a
> syntax error.  ( is unexpected.  I checked that they all match up
> properly but I can't find where the problem is.  I am working on my
> shell scripting but I am by no means good at it.  Is there something
> else that needs to happen first?
> 
> Thanks for all the help
> Dave Baldwin
> 
> 
> 
> -----Original Message-----
> From: David Ledger [mailto:dledger at ivdcs.demon.co.uk] 
> Sent: Thursday, August 16, 2001 6:56 AM
> To: sunhelp at sunhelp.org
> Subject: RE: [SunHELP] $DISPLAY for root
> 
> >
> >  > >Hi,
> >>  >When I "su -" to any user the display is not set.
> >>  >I can't remember if this was happening always but I
> >>  started noticing it
> >>  >after installing ssh and enabling X11 forwarding.
> >>  >Note: this happens even when ssh is not in use.
> >>  >Thanks for any help or suggestions, always
> >>  appreciated.
> >>  >
> >  > >Dave Baldwin
> 
> # Set the DISPLAY global environment variable.
> 	if [ ! "$DISPLAY" ]; then
> 	       set -A DISPLAY $(who -um)
> 	       DISPLAY=${DISPLAY[$((${#DISPLAY[*]} - 1))]}
> 	       DISPLAY=${DISPLAY%:0.0}:0.0
> 	       export DISPLAY
> 
> should do it.  My .profile calls a script that does the above first, 
> and if that fails to give an answer it looks up the process tree to 
> find the xterm process.  My xterm starter scripts always use the 
> -display as the first parameter so it appears in a ps list for that 
> reason.
> 
> David.
> 
> -- 
> David Ledger - Freelance Unix Sysadmin in the UK.
> Chair of SysAdmin SIG of HP/Works technical user group
> dledger at ivdcs.co.uk (also dledger at ivdcs.demon.co.uk)
> www.ivdcs.co.uk
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
> 





More information about the SunHELP mailing list