RSH and .profile

Hello all,

Here's my problem:

When i try to execute a command using rsh (ksh on AIX 5.1):

  rsh <host> -l <user> -c <command>

the .profile is not executed.
Is there a solution ?

Thanx

.profile gets executed only when you login interactively. But rsh just try to execute the command you desired to execute, and in order to execute the command successfully, it need to verify the right user name. Hence passing the user name will not just make the .profile to get executed.

add user in the .rhosts file.

Thank you for your replies,

.rhosts and hosts.equiv files are OK. The rsh command is executed but not the .profile.
I've tried to combine the 2 commands like this : (. ~user/.profile ; command ) but this syntax doesn'nt seems to work.
Is there really no solution ?

Not by any means an rsh expert but I would try ". ~user/.profile ; command"

Perhaps someone else has another suggestion if that does not work.

Yes, this form works but .profile and command are executed in 2 differents processes so the environment defined in .profile is not known by the second process.

Another idea?

Create a script to run on the second system that sources the .profile and runs the command you want to run.

To source the .profile in a script or on a command line(assuming you are in the home directory): $ . ./.profile

You can run .profile as just
.profile with out any extra . (Provided you should have PATH contains $HOME)

Makes you env avialble to the second command from .profile.

or

as RTM said , run as . ./.profile to run it in the parent shell to make env available to the second command.

./.profile or . .profile run .profile in the child shell.