1

I would like to know if there is a (simple) solution to the following issue:

When I log in with ssh to a specific host, I would like to automatically execute a (bash)script on that host. This way I could -for example- load my aliases on that host.

Definitively the bashrc script is not executed; The ssh configuration files do not seem to help in this issue either.

Any suggestions?

Thanks in advance!

BTW: The host is running on Gentoo

5
  • 1
    Interesting that .bashrc isn't executed. Is there a .profile script that runs? Have you tried that? Commented Oct 14, 2010 at 13:54
  • @pjmorse: Post your suggestion as an answer so Stobbej can accept it. Commented Oct 14, 2010 at 14:32
  • Ouch. Sorry, I really should have read the comments first. So while my answer is technically the first, it's actually a rip-off of pjmorse's. My apologies again, that was not intended. Commented Oct 14, 2010 at 14:53
  • @Olfan: Duplication doesn't mean you don't have something useful to add - in this case, the symlink suggestion. Commented Oct 14, 2010 at 15:01
  • Again, thanks to both of you guys(?), for both the solution and the background information! Commented Oct 16, 2010 at 12:17

2 Answers 2

2

If .bashrc isn't being run, try .profile, which has a similar function. Different shells use different startup scripts at different times, so knowing when to run things is useful.

Sign up to request clarification or add additional context in comments.

Comments

1

On many systems where you have a choice of which shell to use, you are put through ~/.profile only. This way there is no need to find out (and no probably wrong guessing) which shell you're running in and which profile to actually load (.bashrc, .cshrc, .kshrc etc.) and which ones to avoid loading.

The easiest solution in your case would be to create a link (a symbolic one if you prefer visibility) to your favourite shell's startup script as in ln -s ~/.bashrc ~/.profile. If you don't intend to ever using anything other than bash, you're set.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.