DISPLAY Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting DISPLAY Script
# 1  
Old 11-03-2008
DISPLAY Script

Good Morning
I am Trying to Create a Script that @ startup sets the DISPLAY Variable
So i can Use Plink to Start X11 Applications
(*\plink.exe **** sh display.sh; eclipse)

Tools : Xming and Putty/Plink
SSH-Connection to LinuxServer

I startet with sh and that didnt work so after sh now tcsh

Both Do Their Jobs : Meaning both set the right IPs BUT
As Soon as i leave the Script and Start a Programm the change is "lost"

More explisit : (as above) sh display.sh : sets the right IP but
script ends : and eclise starts : DISPLAY is emtpy again

Code:
#!/bin/sh
echo setting Display from
echo $DISPLAY
DISPLAY=`echo $SSH_CLIENT | cut -d " " -f1`:0; export DISPLAY
echo to $DISPLAY

@ same for tcsh
Code:
setenv DISPLAY `echo $SSH_CLIENT | cut -d " " -f1`:0

the

SH : export function gives me a
Code:
': not a valid identifier`DISPLAY

As Well as the SetEnv

TCSH : no error, but after Script there is no Display Found


Doing the Procedure "by hand" works just fine @ all shells possible
and All Programms : So it cannot be the X11 Configuration
# 2  
Old 11-03-2008
It's not really clear to me but try to start the script in the current environtment.
Make your script executable (chmod 755) and run the script as follow:

Code:
. ./display.sh

instead of

Code:
sh display.sh

# 3  
Old 11-03-2008
That is a Problem i tried to leave out Smilie
I tried everything i knew (basic knowledge : chmod +x , or 755, file is sown to be "execuable" *) to run the script "normal" but whatever i do i always get

Code:
./display.sh: Befehl nicht gefunden (command not found)
Exitcode 1

so i fell back @ "sh script" and "tcsh script"

Code:
[FruF]>setenv DISPLAY 1234
[FruF]>echo $DISPLAY
1234
[FruF]>sh bash.sh
Set_Display
1234
': not a valid identifier`DISPLAY
10.4.xxx.32:0
[FruF]>echo $DISPLAY
1234
[FruF]>tcsh tcsh.sh
/bin/ls: Kein Treffer.
setting Display
from 
to 10.4.xxx.32:0
[FruF]>echo $DISPLAY
1234

So The logical Explanation is :
I dont know something about scripts

the last 4 Lines :
from *empty*
... meaning the display i set (1234) was not found
to *correct ip*
... meaning setenv did well and echo shows correct ip Smilie
echo
... meaning display back to fake ip ....
# 4  
Old 11-03-2008
I'm really confused, it should be helpful if you post the contents of bash.sh and display.sh.

Regards
# 5  
Old 11-04-2008
The SH File

Code:
#!/bin/sh
echo from $DISPLAY
DISPLAY=`echo $SSH_CLIENT | cut -d " " -f1`:0
export DISPLAY
echo to $DISPLAY

(export Display gives Error : ': not a valid identifier`DISPLAY )


The TCSH File

Code:
#!/bin/tcsh
echo Display from $DISPLAY
setenv DISPLAY `echo $SSH_CLIENT | cut -d " " -f1`:0
echo to $DISPLAY

# 6  
Old 11-04-2008
I don't get any error with the script, maybe someone else can bring some light in the darkness.
# 7  
Old 11-04-2008
mnm ok
But is ur Display Set to the Correct IP After Script is done `? or does is just change the DISPLAy within the script
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with script to display space usage

Hi all, I am looking for help with a script for displaying the space available from a df - h command for / (root). The problem is: If it is below 700 MB I have jobs that are failing... Is there a way I can do a calculation? If it above 700 MB it is good, if it is below 700 MB it will fail.... (5 Replies)
Discussion started by: gartie
5 Replies

2. Shell Programming and Scripting

Script with ^M causes display issue with cat or more

I have a script to do a couple simple but repetitive commands on files that are provided to us. One of the things is to get rid of the line feeds. This is the section that is causing problems, i even cut this section into its own file to make sure nothing else was affecting it. #!/usr/bin/bash... (4 Replies)
Discussion started by: oly_r
4 Replies

3. Shell Programming and Scripting

Help with Display Shell Script

hi Friends, I am writing a shell script to extract data from sar logs for my daily analysis. I have this in sar logs HP-UX dhpcdbe1 B.11.31 U ia64 05/09/12 01:22:42 device %busy avque r+w/s blks/s avwait avserv 01:27:59 disk30 8.79 13.72 26 427 36.47 ... (3 Replies)
Discussion started by: kunwar
3 Replies

4. Shell Programming and Scripting

How to display a counter in shell script?

Hi, I am writing a script which processes large number of files in a directory. I wanto display a counter which increment after processing each file. I am processing each file in a for loop. If I echo a variable with its value increasing with each file, I will get around 5000 lines as output.... (10 Replies)
Discussion started by: jaiseaugustine
10 Replies

5. UNIX Desktop Questions & Answers

Script that will display a short message

Can anyone point me to the right direction on how to write a simple script that will display a message on any terminal when implemented? Basically I need it so the script runs at a certain time, say April 30, 2010 and that the message will be displayed to me no matter which terminal I am logged... (2 Replies)
Discussion started by: jmack123
2 Replies

6. Shell Programming and Scripting

Script to display

I have script which prints following o/p ServerName = server1 Proc0 :Temperature 61 Proc1 :Temperature 60 CPU 99.4% idle, Now since i have to feed this data to another java program i want the out put as follows Name Proc0 Temp Proc1 Temp CPU... (5 Replies)
Discussion started by: fugitive
5 Replies

7. Shell Programming and Scripting

script to display time

hey folks, i am stuc in this problem. You all might help me out. I want to write a BASH script to display time every 15 seconds using %r field descriptor. And want to clear the window each time before displaying time using clear command. Please help me out (3 Replies)
Discussion started by: manojrsb
3 Replies

8. Shell Programming and Scripting

Script to display time difference..

Hi i've written a script which reads last two line of the log file from N number of servers and send the mail by redirecting to a particular log file. And the two lines is displayed below. Oracle Q03 Begin Hot BACKUP Time: 07/23/08 18:35:46 Oracle Q03 End Hot BACKUP Time: 07/24/08 14:18:15... (1 Reply)
Discussion started by: suri.tyson
1 Replies

9. UNIX for Dummies Questions & Answers

Shell Script Display?

I remember learning that there is a way to make a shell script display the script itself to standard output while the script is being executed but I can't find how to do that. Any pointers? (2 Replies)
Discussion started by: wmosley2
2 Replies
Login or Register to Ask a Question