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.

I am making a Debian package that contains bash aliases.

Where should these aliases be installed, so that they are available system-wide?

The "right" place would be /etc/bash.bashrc, but this file is owned by the bash package, which will overwrite it on the next upgrade.

I tried to put them in /etc/profile.d/my-aliases.sh but this affects only login shells (for example it works in the consoles). Interactive shells do not get the aliases.

It does "work" if I put them in /etc/bash_completion.d/my-aliases.sh, but this is not meant to be used that way.

So my question is:

Where (or how) should I install aliases, so they are available to interactive shells system-wide?

share|improve this question
    
Why do you limit the aliases to the bash shell? apt-get aliases could be used in any shell, I suppose. –  Marco May 31 '13 at 9:42
    
because I have limited time, and I wrote it first for bash? Because different shells have different syntax and this would multiply my installation issue? –  oluc May 31 '13 at 14:33
    
What other shell alias syntax exists? Cshell, what's more? –  oluc May 31 '13 at 14:35
    
/etc/skel and /etc/profile.d come to mind as possible alternatives. The former will only help new users, though. The latter will need some conditionals to avoid loading into non-Bash shells, if that is really a concern. –  tripleee May 31 '13 at 16:17
    
@tripleee, profile.d affects only login shells. –  oluc May 31 '13 at 16:33
show 1 more comment

1 Answer

up vote 0 down vote accepted

It works for /etc/bash_completion.d/my-aliases.sh because /etc/bash_completion has a facility to process things under /etc/bash_completion.d/.

Since /etc/bash.bashrc does not have such a facility (yet). There is IMHO currently no better place to put things.

share|improve this answer
    
That's the conclusion I ended up with. But it is not very satisfying, it's a hack. I had hope that there would be a way. –  oluc May 31 '13 at 14:38
add comment

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.