store the return value of $DISPLAY into my perl script
I want to store the return value of $DISPLAY into my perl script. I am new in perl script
echo $DISPLAY how could i make it? #! /apps/perl/bin/perl $session = `echo $DISPLAY`; print "$session\n"; but nothing come out :( ------------ in linux xterm echo $DISPLAY -->return :0 |
that's a real horrible way to do what you want, do it properly - http://perldoc.perl.org/Env.html
|
Wow, it is a much easier way
use Env qw( $DISPLAY ); print("\nMy session = $DISPLAY\n"; many thanks! to find linux variable, type env in xterm |
#! /apps/perl/bin/perl
use Env qw( $DISPLAY $HOST); print("\nMy hostname = $HOST\n") ; print("\nMy session = $DISPLAY\n") ; $NEWDISPLAY = join("", "$HOST","$DISPLAY"); print("\nMy new display = $NEWDISPLAY\n" ) ; |
All times are GMT -5. The time now is 03:06 PM. |