Is there a totally empty Bash file I can use (or create) to extend .bashrc and .profile?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0














I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead.



When I rent a new IaaS system with Bash as main shell, the first step I take is (an extended version) of this:



cat <<-EOF >> "$HOME"/.profile

set -x && complete -r
EOF

source "$HOME"/.profile


The extra empty line there between the "routine" to the "subroutine" content is because .profile already includes some data, and I want to separate the new data I append (which can be more than the single line of set -x && complete -r) from the rest of the already-present data.



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 without an extra empty line. A quick look in my user's directory in Ubuntu 16.04 (xenial) shows no such file.



Is there a file like I desire in another directory or should I create one myself? If so, please only hint how it should be done










share|improve this question



















  • 3




    Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
    – Jeff Schaller
    Dec 14 at 1:33










  • Have you researched /etc/skel?
    – eyoung100
    Dec 14 at 2:13










  • @eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
    – JohnDoea
    Dec 14 at 2:45










  • @JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
    – JohnDoea
    Dec 14 at 4:04










  • @JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
    – eyoung100
    Dec 14 at 4:46















0














I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead.



When I rent a new IaaS system with Bash as main shell, the first step I take is (an extended version) of this:



cat <<-EOF >> "$HOME"/.profile

set -x && complete -r
EOF

source "$HOME"/.profile


The extra empty line there between the "routine" to the "subroutine" content is because .profile already includes some data, and I want to separate the new data I append (which can be more than the single line of set -x && complete -r) from the rest of the already-present data.



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 without an extra empty line. A quick look in my user's directory in Ubuntu 16.04 (xenial) shows no such file.



Is there a file like I desire in another directory or should I create one myself? If so, please only hint how it should be done










share|improve this question



















  • 3




    Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
    – Jeff Schaller
    Dec 14 at 1:33










  • Have you researched /etc/skel?
    – eyoung100
    Dec 14 at 2:13










  • @eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
    – JohnDoea
    Dec 14 at 2:45










  • @JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
    – JohnDoea
    Dec 14 at 4:04










  • @JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
    – eyoung100
    Dec 14 at 4:46













0












0








0







I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead.



When I rent a new IaaS system with Bash as main shell, the first step I take is (an extended version) of this:



cat <<-EOF >> "$HOME"/.profile

set -x && complete -r
EOF

source "$HOME"/.profile


The extra empty line there between the "routine" to the "subroutine" content is because .profile already includes some data, and I want to separate the new data I append (which can be more than the single line of set -x && complete -r) from the rest of the already-present data.



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 without an extra empty line. A quick look in my user's directory in Ubuntu 16.04 (xenial) shows no such file.



Is there a file like I desire in another directory or should I create one myself? If so, please only hint how it should be done










share|improve this question















I know that by principle, one shouldn't change .bashrc and common changes like creating an alias should better be done in .profile instead.



When I rent a new IaaS system with Bash as main shell, the first step I take is (an extended version) of this:



cat <<-EOF >> "$HOME"/.profile

set -x && complete -r
EOF

source "$HOME"/.profile


The extra empty line there between the "routine" to the "subroutine" content is because .profile already includes some data, and I want to separate the new data I append (which can be more than the single line of set -x && complete -r) from the rest of the already-present data.



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 without an extra empty line. A quick look in my user's directory in Ubuntu 16.04 (xenial) shows no such file.



Is there a file like I desire in another directory or should I create one myself? If so, please only hint how it should be done







bash login profile dot-files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 14 at 7:44









Gilles

527k12710561581




527k12710561581










asked Dec 14 at 1:17









JohnDoea

1311132




1311132







  • 3




    Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
    – Jeff Schaller
    Dec 14 at 1:33










  • Have you researched /etc/skel?
    – eyoung100
    Dec 14 at 2:13










  • @eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
    – JohnDoea
    Dec 14 at 2:45










  • @JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
    – JohnDoea
    Dec 14 at 4:04










  • @JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
    – eyoung100
    Dec 14 at 4:46












  • 3




    Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
    – Jeff Schaller
    Dec 14 at 1:33










  • Have you researched /etc/skel?
    – eyoung100
    Dec 14 at 2:13










  • @eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
    – JohnDoea
    Dec 14 at 2:45










  • @JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
    – JohnDoea
    Dec 14 at 4:04










  • @JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
    – eyoung100
    Dec 14 at 4:46







3




3




Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
– Jeff Schaller
Dec 14 at 1:33




Not an answer, since I'm questioning one of your assumptions. Why do you not want to change your (own) .profile or .bashrc?
– Jeff Schaller
Dec 14 at 1:33












Have you researched /etc/skel?
– eyoung100
Dec 14 at 2:13




Have you researched /etc/skel?
– eyoung100
Dec 14 at 2:13












@eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
– JohnDoea
Dec 14 at 2:45




@eyoung100 after you mentioned it. I understand it uses to set the structure of a new user's directory, but I already created my user and doesn't want to create a new one...
– JohnDoea
Dec 14 at 2:45












@JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
– JohnDoea
Dec 14 at 4:04




@JeffSchaller First, by principle I'd like to avoid hanging existing shell-direction files as much as I can. Secondly, and as absurd as it can be grasped - I prefer to save this extra line
– JohnDoea
Dec 14 at 4:04












@JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
– eyoung100
Dec 14 at 4:46




@JohnDoea I'm not saying create another user. Consider reading the file in: /etc/skel/.profile Create a template etc, cat it in then save the result to your .profile
– eyoung100
Dec 14 at 4:46










1 Answer
1






active

oldest

votes


















5















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.



.profile and .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 .bashrc.




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 .profile and .bashrc to include your file. In both .profile and .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 ~/etc/profile.

  • Bash customizations go into ~/etc/bashrc.


  • 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
    EOF



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.






share|improve this answer




















  • +1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
    – JohnDoea
    Dec 16 at 3:04











  • @JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
    – Gilles
    Dec 16 at 11:09










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487898%2fis-there-a-totally-empty-bash-file-i-can-use-or-create-to-extend-bashrc-and%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5















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.



.profile and .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 .bashrc.




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 .profile and .bashrc to include your file. In both .profile and .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 ~/etc/profile.

  • Bash customizations go into ~/etc/bashrc.


  • 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
    EOF



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.






share|improve this answer




















  • +1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
    – JohnDoea
    Dec 16 at 3:04











  • @JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
    – Gilles
    Dec 16 at 11:09















5















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.



.profile and .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 .bashrc.




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 .profile and .bashrc to include your file. In both .profile and .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 ~/etc/profile.

  • Bash customizations go into ~/etc/bashrc.


  • 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
    EOF



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.






share|improve this answer




















  • +1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
    – JohnDoea
    Dec 16 at 3:04











  • @JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
    – Gilles
    Dec 16 at 11:09













5












5








5







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.



.profile and .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 .bashrc.




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 .profile and .bashrc to include your file. In both .profile and .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 ~/etc/profile.

  • Bash customizations go into ~/etc/bashrc.


  • 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
    EOF



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.






share|improve this answer













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.



.profile and .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 .bashrc.




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 .profile and .bashrc to include your file. In both .profile and .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 ~/etc/profile.

  • Bash customizations go into ~/etc/bashrc.


  • 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
    EOF



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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 14 at 7:53









Gilles

527k12710561581




527k12710561581











  • +1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
    – JohnDoea
    Dec 16 at 3:04











  • @JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
    – Gilles
    Dec 16 at 11:09
















  • +1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
    – JohnDoea
    Dec 16 at 3:04











  • @JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
    – Gilles
    Dec 16 at 11:09















+1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
– JohnDoea
Dec 16 at 3:04





+1 Gilles, one small thing, please; complete -r seems to work great for me from .profile; if I understand you correctly, philosophically it should be in .bashrc but there is no prevention to put it in .profile as an exception, so it shouldn't hurt, right?
– JohnDoea
Dec 16 at 3:04













@JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
– Gilles
Dec 16 at 11:09




@JohnDoea If you put it in .profile, it'll cause an error if .profile is executed by a different shell (which may not matter to you if you only ever log in with SSH) and it won't take effect if you run a non-login shell (e.g. in screen or tmux). It's a practical difference, not a philosophical difference.
– Gilles
Dec 16 at 11:09

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487898%2fis-there-a-totally-empty-bash-file-i-can-use-or-create-to-extend-bashrc-and%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay