質問

I am trying to set bash as my default shell in my university account.

However, the traditional chsh approach does not work here because the university techs have disabled that as a startup shell. But, I can invoke bash by just calling bash from my terminal. So, I've developed a small hack that enables my current shell csh to start bash automatically by modifying my ~/.cshrc file so that it calls bash from it. The thing is, I wish to set it up in such way that when I exit my bash session, I want it to close it's parent csh session as well. How can I do that?

== EDIT ==

Word of caution: as ajk warned about scripts running with csh, I found out the hard way that the login sequence is done precisely on that shell. I can no longer login into my machine now. I will have to contact my university techs about the removal of the rc file. Which I doubt will make them happy. :\

So, take heed.

役に立ちましたか?

解決

Start bash like this in your .cshrc file:

exec bash

Preferably, replace bash with the full path to bash.

Also, be careful if you have to run any script written in csh—if it doesn't use -f, it will execute your .cshrc file before running. Since you exec bash in your .cshrc, the script probably won't run as intended. Writing scripts in csh is inadvisable, but I've been in at least one university course that required it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top