- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: need a easy script for display seting.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 02:03 AM
06-28-2005 02:03 AM
1) All my freinds are using 3 commands
#DISPLAY=ip:0.0;export DISPLAY;echo $DISPLAY)
to set display i want to make it in one script.
So i have writen a script for it as follows
**********************************************
#/sbin/sh
echo "type your local pc ip address below"
read ip
DISPLAY=$ip:0.0
export DISPLAY
echo DISPLAY
**********************************************
it shows correctly till echo
but as if it is running in a child shell (i hope i'm correct) the setting is getting disappeared at the end when it return back to its parent shell
is thr any way to make it set for its parent shell also.
tell me is thr any way to do it.
thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 02:11 AM
06-28-2005 02:11 AM
Re: need a easy script for display seting.
you need to execute you script by:
a) in sh,ksh shell:
. ./your_script_name
or
. /full_path/your_script_name
b) in csh, tcsh
source ./you_script_name
Ps,
replace echo DISPLAY to echo $DISPLAY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 02:15 AM
06-28-2005 02:15 AM
Re: need a easy script for display seting.
$ . /scriptname
Or my easy way to do it:
$ export DISPLAY=host:0.0
There you go. 1 statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 02:27 AM
06-28-2005 02:27 AM
Re: need a easy script for display seting.
you have to execute the script in current shell, generally it is executed in the sub shell.
execute the commands with in { } and source it using ./script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 02:53 AM
06-28-2005 02:53 AM
Re: need a easy script for display seting.
************
Slawomir
see i have given that script 755 as permision and i have copied it to /usr/bin
then only i have executed it..
i tried in ./fullpath/script but the too once the script ends the setting is disappeared
and it is acutally echo $DISPLAY only i have mis typed in this
********************
Hi Patrick
I have tried yours too..
but no working.. same
export DISPLAY ( i don't want normal users to know unix.. and i want them to use my the simpliest way)
************************************
Hi gopi
i do not how to use {} in scriopts i have tried this
echo "type your local pc ip address below"
read ip
{DISPLAY=$ip:0.0
export DISPLAY}
echo $DISPLAY
but when i xecute it is telling that thr is error in my script
LD[3]:DISPLAY=172.14.14.2:0.0}: not found
LD[4]:DISPLAY} is not an identifier
****************************************8
any other way to do the same
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 03:17 AM
06-28-2005 03:17 AM
Re: need a easy script for display seting.
my mistake, I believe i dint read the question clearly. modify the script like this
#/sbin/sh
echo "type your local pc ip address below"
read ip
export DISPLAY=$ip:0.0
echo DISPLAY
and then call the script like this
. /path/to/script
The dot before the script name is very important because it tells the bash not to spawn a subshell rather to use the current shell itself
Hope this helps,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 03:22 AM
06-28-2005 03:22 AM
Re: need a easy script for display seting.
export DISPLAY=ip:0.0
The last line in your script should read
echo $DISPLAY
whenever you reference a variable after it has been set, you must use the form $VARIABLE_NAME
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 03:28 AM
06-28-2005 03:28 AM
Re: need a easy script for display seting.
i forgot to tell you that there should be a space between . and the path to the script.
eg: . /path/to/script
no points for this pls...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 03:33 AM
06-28-2005 03:33 AM
SolutionMy profile on the remote system will execute who -um and I run through awk to get last field
who -um | awk '{print $NF}'
So when I connect the profile has
export DISPLAY=`who -um | awk '{print $NF}'`:0
My DISPLAY is always exported
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 03:49 AM
06-28-2005 03:49 AM
Re: need a easy script for display seting.
i have not seen that space between the dot...
now i got cleared both of you r very great...
Gopi your answer is correct but what Slawomir and Partick said is explaied below that is a excellent answer for one and all
instead of using ./fullpath/script (which i have tried and got failed) i must be using
. ./script (rember two dots inbetween a space " . ./" if the script is in your working directory)
is the solution..
there is still a more to tell if the script is not in the present directory then insted of using ". ./" we must use ". /full path/script" ("dot space full path")
Thanks A lot
good luck for all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2005 04:03 AM
06-28-2005 04:03 AM
Re: need a easy script for display seting.
all my problem is sloved you gave a wonderful answer..
no comments
try this bye bye
banner "Rick is great"