Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Or are they both not allowed at the same time?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Not only is it possible, some systems set up new accounts with both. This allows the same skeleton setup to be used whichever shell the user gets.

The purpose of the two file is the same, but they belong to two different shell families. The syntax of the shell scripts for the two shells is very different so different scripts are required.

With a bit of care it is possible to use the same rc file for Bourne shell, ksh, and bash. This can be done by inclusion or hard links.

share|improve this answer
    
It can also be done by testing in the rc file for the current shell. –  Keith Thompson Jan 21 '12 at 0:26
    
@KeithThompson: Use of inclusion and hard links can be used when the rc names are different: .shrc. .kshrd, .bashrc, etc. Testing the for the shell type might be required in some edge case. –  BillThor Jan 21 '12 at 3:22
    
bash, ksh, and zsh will all source $HOME/.profile, at least if their shell-specific startup files aren't available. Having a single .profile with shell-specific sections (checking whether $BASH_VERSION is set, and so on) might be a reasonable approach if you commonly use two or more Bourne-derived shells. (I haven't tried that myself.) –  Keith Thompson Jan 21 '12 at 6:13
    
@KeithThompson: The bourne shell variants tend to share profiles but this is not always the case. The rc files usually have different defaults, although there can be configuration options to address this. Newer shell builds and newer platforms tend to be more likely to have this capability. –  BillThor Jan 21 '12 at 23:57

Why wouldn't they be?

They're only executed by their respective shells though...

csh and bash are different programs that happen to do similar functions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.