I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead.
This doesn't make any sense. You probably misunderstood what you read. There is no reason why you shouldn't change
.bashrc. On the contrary, this is your customization file. It's there precisely so that you can put whatever you want in it. You don't have to keep whatever was there at the beginning, and you can add what you want.
.bashrc are both your customization files, but they have different roles.
.profile is for login-time things like environment variables.
.bashrc is for shell configuration like aliases and completion settings.
set -x is for debugging only.
complete -x is a shell customization, not a login-time setting, so it goes into
I need another file, one that comes empty but also acts as a "boot file" similarly to .bashrc and .profile to which I can append the data
If for some reason you want to keep whatever was there at the beginning but don't want to continually modify the existing files, then you can create other files, and put an instruction in
.bashrc to include your file. In both
.bashrc, you can use the command
. (nicknamed “dot”) followed by a file name to read instructions from that file. For example, if you want to put all your customizations in a directory called
etc so that you can quickly deploy it, then here's what you can do:
- Login-time things such as environment variables go into
- Bash customizations go into
Your first-time deployment code can be something like this.
rsync -a remote-deployments/etc mynewhost.example.com/etc
ssh mynewhost.example.com -c <<'EOF'
grep -q -s -F '~/etc/profile' ~/.profile || echo '. ~/etc/profile' >>.profile
grep -q -s -F '~/etc/bashrc' ~/.bashrc || echo '. ~/etc/bashrc' >>.bashrc
without an extra empty line.
You chose to put an empty line there. It doesn't hurt anything. There is absolutely no reason not to put an empty line. But if you don't want an empty line, it's your choice. Don't put it there.