Quote:
Originally Posted by noir911
That's what I said in my original post, the Solaris box is not mine & I cannot change the .profile in the login ID I have.
|
??? I thought it was a little confusing when you originally posted it. What it said was, "as this is my own box":
Quote:
Originally Posted by noir911
I know I can automate the whole thing but I would rather not as this is my my own box
|
OK. So, the box is *not* yours. Is the login yours? Or are you doing the classically insecure sharing of a login with others? Or is this the root login that you are ssh'ing to?
I don't allow remote connections to root on my Solaris boxes. Everyone has to have their own unique login. Then they use su if they are an admin, or sudo if they are a semi-privileged user, in order to do things that require root privileges.
So, if it is your login, you can still edit your .profile.
If it is a shared login, you can create another script as suggested by jlliagre.
Note that the behavior of the script may initially seem counter intuitive. When it invokes bash, it starts a subprocess and you are in that until you exit. Your setting of environment variables will not happen until after you exit bash (using the sequence you originally posted). Then they will disappear when you exit the script (if you invoke it with "./script").
So, what you want is to put the setting of the environment variables before you invoke bash and export them so that they go to the bash subprocess. If you wanted them to be set in your current process, then you could invoke the script with ". ./script" (that is "dot space dot slash"), which executes the script within your current process rather than starting a subprocess.