set env variables in a new xterm


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers set env variables in a new xterm
# 1  
Old 05-06-2009
set env variables in a new xterm

Hi,
I have a script that sets some env variables.
I want to source the script in a new xterm and
after the script execution is over, the xterm has to be alive with the env variables set according to the script.
I tried
xterm -e "source ./myscript;tcsh" &

The variables are getting set during program execution.
I knew this because i used an echo in the script.
After the program execution is over, the xterm is alive,
but the env variables are lost.

Please help me.

Thank u.
# 2  
Old 05-06-2009
Just thoughts...
Since I dont use tcsh, I would in ksh do like this:
Write a script which contains
Code:
. ./newprofile_env
xterm &

In newprofile_env you would find your variable you want to set and export
# 3  
Old 05-07-2009
Thanks for the reply

If I do like you told, in the parent shell also the env varibles will be set.

I dont want to set that varibles in the parent shell, I just want the varibles set in new xterm.


Please help me
# 4  
Old 05-07-2009
But the parent shell is the one you use only to initialize your variables and then launches xterm in other words the shell which is executing the script:

titi: a test script to demonstrate:
Code:
#!/usr/bin/ksh
echo "Enter date (MM/DD/YY)"
read USRDATE
echo " Enter thr group"
read USRGROUP
echo USRDATE=$USRDATE USRGROUP=$USRGROUP
export USRDATE
xterm&
read KYB
echo "USRDATE : " $USRDATE
read KYB
date
echo "That's all..."

Quote:
the session executing titi:
ant:/home/vbe $ ./titi
Enter date (MM/DD/YY)
05/07/09
Enter thr group
titi
USRDATE=05/07/09 USRGROUP=titi

USRDATE : 05/07/09

Thu May 7 10:31:38 METDST 2009
That's all...
ant:/home/vbe $ echo $USRDATE

ant:/home/vbe $
------
The xterm session:
ant:/home/vbe $ date
Thu May 7 10:31:46 METDST 2009
ant:/home/vbe $ echo $USRDATE
05/07/09
ant:/home/vbe $
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Set env variables for user

Hi , I have installed oracle in Solaris machine and unable to set the env variable. I tried to put the env variable in .dtprofile file but didn't help. So everytime I login in need to run the command and export the variable. Kindly suggest where I am doing wrong.Pls excuse as I am not too... (2 Replies)
Discussion started by: Rossdba
2 Replies

2. Red Hat

Set Env

Hi, I need to add file the /usr/lib under the command set. The /usr/lib need to be set under the DIRS=' ' while listing the set command. I tried with the command below: export PATH=${PATH}:/usr/bin But this doesn't work out... (4 Replies)
Discussion started by: gsiva
4 Replies

3. Red Hat

How to set xterm for Window Titls for PuTTy

Hi, I still cant find step by step manual how to make my putty display let say PWD in its title, read about some xterm, but where it is? Can anybody help me with this. Thx M (4 Replies)
Discussion started by: trento17
4 Replies

4. Red Hat

how to use env variables within ed

i have a file that i need to edit and replace a single value with another. so i have two variables, $oldvalue and $newvalue but below doesn't work: ed file.txt << EOF ,s/$oldversion/$newversion/g wq EOFi presume it's the $ that is the issue since it's actually special to ed. any suggestions?... (1 Reply)
Discussion started by: crimso
1 Replies

5. Solaris

env variables again

What is the difference between ${variable} and $variable when used in a script? (2 Replies)
Discussion started by: orange47
2 Replies

6. Solaris

How to set PS1 in env

Hello whenenver i login to solaris server the prompt is displaying as #. i want to customize the promt with server name for all users. how to customize the PS1 variable for all the users?. Thanks for your help in advance. regards, Saravana (2 Replies)
Discussion started by: tsaravanan
2 Replies

7. UNIX for Advanced & Expert Users

How to export ENV variables, which remains set for all the shell

Hi ! How to export ENV variables, which remains set for all the shell Example :- Login :myID Pwd : **** -> Here my ID .profile is executed. Let say I set MYENV variable Kisses% rlogin ABC -l XXXGroupID -> I login into a remote Solaris Server ABC password : **** -> "XXXGroupID's... (1 Reply)
Discussion started by: dashok.83
1 Replies

8. Shell Programming and Scripting

Getting the value of env variables

Hi, I want to get the value of the env varables using the ksh script. All the env variables are stored in a file. Eg. file1 $INPATH $OUTPATH myscirpt: for name in `awk { print $1 } file1` do cd $name done i'm getting the error like $INPATH not found. in the same script... (1 Reply)
Discussion started by: vij_krr
1 Replies

9. Solaris

How to set color in the xterm

Hello Friends, I am using solaris 10 operating system. I would like to know how to use the xterm color in it. I am trying this command:- xterm -bg color, but it is giving this talc:/home/ania {ania} xterm -bg color 21469 -bg: Command not found. What should i do? Can u help me... (3 Replies)
Discussion started by: asirohi
3 Replies

10. Solaris

latin 2 character-set with xterm

Hi, We have problems with the latin 2 Character-set with xterm. We have installed SunRay-Server with Solaris 8. Our Thinclients use hu- and cz-keyboards. I have set the right local-settings and xmodemaps. If I use the dtterm all is running fine. As soon as I use the xterm, it cannot display... (0 Replies)
Discussion started by: paho
0 Replies
Login or Register to Ask a Question