0

I have the following lines in my .bashrc which I would like to get executed upon logging in through ssh.

csh
source /x/y/.cshrc
source /x/y/z/sourceme

But the problem is that only the first command is being executed correctly. (csh prompt is coming up) The following source command is not effected. I noticed that there are some errors which are thrown from bash (not csh) for the 'source' command

I read somewhere that this may be due to .bashrc getting executed multiple times. And source commands trying to get executed in bash itself rather than csh.

I want all the three commands to be executed one after other upon log-in. how can I do that? I tried .bash_profile .bash_login etc. Also I don't have write access to /etc/profile

gkns
  • 697
  • 2
  • 12
  • 32

3 Answers3

3

The "commands" are interpreted by the bash shell. They aren't bytes to be fed to the terminal. What happens is that csh runs interactively, and once it exits bash will source the two (presumably csh) script files.

It looks like you're simply trying to change your shell to csh (why, I have no idea). Have you tried using chsh for that?

Andy Ross
  • 11,699
  • 1
  • 34
  • 31
  • I am trying to change the shell to csh, and running some scripts for adding some environment variables for csh. Currently I don't have a bash version of this environment configuration script. – gkns Aug 23 '12 at 05:49
1

If you want to run these commands in csh, move them to your .cshrc.

A word of caution, though; using csh for absolutely anything raises the question, do you really think you know what you are doing? Why?

chepner
  • 497,756
  • 71
  • 530
  • 681
tripleee
  • 175,061
  • 34
  • 275
  • 318
0

source is a "bashism", that is to say it won't work in other shells. Use . instead.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284