Switching hosts and paths

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Switching hosts and paths
# 1  
Old 09-03-2009
Switching hosts and paths

Hi all,

Currently I work with two different hosts, one linux and one hp unix but with two separate versions of java installed (for a reason). The problem is: within the PATH there is already a /bin/java version installed i.e. when I do a printenv PATH it lists it as you'd expect. When I use host1 lets say this is fine, but when I do a ssh host2 -X command, it still inherits the same path. Therefore, even if I add this other path within my .kshrc file, it still inherits the other. How do I make sure the correct java path is inherited when I switch between two different hosts?


# 2  
Old 09-03-2009
How do you add it ot your PATH in .kshrc?
export PATH=$PATH:/... or export PATH=<javapath>:$PATH ?

---------- Post updated at 17:15 ---------- Previous update was at 17:11 ----------

Anyway on HPUX I am responsible, I set no java PATH, letting the user, having to set in his .profile depending on the version he needs:
ant:/home/vbe/script $ ll /opt/java
total 458392
drwxr-xr-x   4 bin        bin             96 Feb 14  2007 java1.2
dr-xr-xr-x   8 bin        bin           1024 May 10  2004 java1.4
drwxr-xr-x   9 bin        bin           1024 Mar 10  2005 java1.5

# 3  
Old 09-03-2009
I use:
export PATH=$PATH:/bin/java/bin: but it doesn't seem to overwrite what has already been set but at the same time this is only useful in getting one version working....
# 4  
Old 09-03-2009
That is because you have in $PATH already somewhere a java...
use export PATH=/bin/java/bin:$PATH
# 5  
Old 09-03-2009
Cool thats worked but it has now just overitten what was already set in the PATH environment, to a differnt version but I still seem to be in the same problem with what I version is accessible, apart from just having two PATH lines to point to diferent versions of Java by commenting one out, is there another way of doing this?
# 6  
Old 09-03-2009
As I already mentionned, the best would be to remove java form PATH, and set individually in .profile or .kshrc as needed, I do this for all software binaries when I have multiple versions...
one alternative is to create source files e.g. java_profile1 java_profile2 etc..
I do this when a software requires it version binaries plus environment VAR to be set as special java path etc... like SAS8 used (java 1.0.X and) netscape, SAS9 uses java 1.2 but also java1.4 and mozilla...
then when you need a profile, just source: . ./the_chosen_profile
# 7  
Old 09-03-2009
okay I get what you're saying, cheers for your help there
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies

2. Programming

Switching over to C++

Hi, We've been using a perl script to extract datas from several logs to generate a report. I've been asked to rewrite the code in C++. I want to know if it is wise to have a code in C++ and will it be more faster than Perl? (23 Replies)
Discussion started by: Ribosome
23 Replies

3. AIX

aix tcp wrappers hosts.allow hosts.deny?

hi all just installed the netsec.options.tcpwrapper from expansion pack, which used to be a rpm, for my aix 6.1 test box. it is so unpredictable. i set up the hosts.deny as suggested for all and allow the sshd for specific ip addresses/hostnames. the tcpdchk says the hosts allowed and... (0 Replies)
Discussion started by: wf201626
0 Replies

4. Solaris

The switching in the different AP's

HI, I am using the windows 2003 server R2 in there we are using the putty as to access the different AP's now from the primary AP i want to login to several different AP's using a script what the script will do is :- input a text file in which list of different ap's and the corresponding... (0 Replies)
Discussion started by: amiglani
0 Replies

5. OS X (Apple)

vt switching

greetings, i hope this hasn't been covered previously. has anyone heard of a .kext or daemon that would allow linux or (open)solaris-like vt switching? googling didn't help much.. i know os x allows a '>console' login from loginwindow.app, but i'm mainly interested in this because there are... (0 Replies)
Discussion started by: bamdad
0 Replies

6. AIX

switching users

Hi All, I used to know a comand that you could log in as another user from root, if you didn't know the password for the account. Can anyone let me know what it is? (2 Replies)
Discussion started by: banchee
2 Replies

7. UNIX for Dummies Questions & Answers

Hosts.allow and hosts.deny

Hello everyone, This is my first posts and I did search for a questions but did not find a question that answered my question unless of course I overlooked it. I'm running Solaris 8. I use ssh for the users but I have a user called "chatterbox" that uses telnet but I need for chatterbox to... (1 Reply)
Discussion started by: huddlestonsnk
1 Replies

8. UNIX for Dummies Questions & Answers

hosts.allow & hosts.deny

Hi! Im trying to use host.allow & host.deny to resrtic access to my sun machine, but it doesnt seem to work... I want to allow full access from certain IPīs (ssh,http,ftp,etc...) but deny all kind of conections from outsideworld, the way that im doing that is: hosts.allow ALL: (2 Replies)
Discussion started by: Sorrento
2 Replies

9. UNIX for Dummies Questions & Answers

switching shells??

Hi How can i switch shells on linux and freebsd? i tried changing the passwd file and restarted the computer but i still get the same old shell. anybody has the answer? thanks (6 Replies)
Discussion started by: xNYx
6 Replies

10. UNIX for Dummies Questions & Answers


Hi there! People, i'm a new unix user, and i'm having some problems... I'm updating some scripts (korn shell) in different servers. I use telnet to access these servers and emacs to write the scripts. One of them is an HP, and thereīs no problem. But the other one is an AIX, and when i call... (1 Reply)
Discussion started by: caiohn
1 Replies
Login or Register to Ask a Question