shEiD Posted April 9, 2019 Share Posted April 9, 2019 (edited) A couple of months ago, I have spent half a day searching here on the forum and googling in general, still I could not manage to make my .bash_profile work. Finally, I just gave up. Please, can someone write up a detailed step by step guide how make .bash_profile work properly and persist the reboots. Please, do not assume that I know any "obvious/mundane/everyday" stuff, when it comes to this sort of thing. What I want to add to my .bash_profile: # History ignore and erase dupes export HISTCONTROL=ignoreboth:erasedups # Aliases alias lir="ls -liR" alias nolinks="find . -type f -links 1 -print" alias efd='bash /mnt/user/temp/scripts/empty-folders-delete' alias efp='bash /mnt/user/temp/scripts/empty-folders-print' alias fsf='bash /mnt/user/temp/scripts/find-samefile/batch-find-samefile' I'm asking, because I would really like to aliases and have nice history. Edited April 11, 2019 by shEiD Solved Quote Link to comment
Delarius Posted April 9, 2019 Share Posted April 9, 2019 I'm not sure if this is the answer you need, but I do this all the time. Make a file with the contents you want at /boot/config/mybashprofile (or whatever name you want but that's the general location.) Then in your go file at /boot/config/go - add a new line that reads: cat /boot/config/mybashprofile >> /root/.bash_profile Reboot to test. 2 1 Quote Link to comment
ShoGinn Posted April 9, 2019 Share Posted April 9, 2019 @Delarius explained the option that I used. His is actually cleaner than mine I took this opportunity to clean mine up. edit the file: /boot/config/go Append the following: bash_profile () { if [ -f /root/.bash_profile ]; then cat /boot/config/mybashprofile >> /root/.bash_profile fi } # Update Bash Profile bash_profile Create your: /boot/config/mybashprofile 1 Quote Link to comment
Delarius Posted April 9, 2019 Share Posted April 9, 2019 That's works too. I just figure if for whatever reason /root/.bash_profile doesn't exist then the cat command will create it, and if it does exist - then the cat command (via >>) will append to it. Thus I don't use a test since there's no condition where the cat command isn't useful. Quote Link to comment
shEiD Posted April 11, 2019 Author Share Posted April 11, 2019 @Delarius @ShoGinn thanks, guys - it worked perfectly 👍 Quote Link to comment
pervel Posted November 16, 2020 Share Posted November 16, 2020 Thanks for the ideas. I made some modifications that seem to work well. This is my /boot/config/go: #!/bin/bash # Start the Management Utility /usr/local/sbin/emhttp & echo "test -f /boot/config/mybashprofile && source /boot/config/mybashprofile" >> /root/.bash_profile Now you can put whatever you want in /boot/config/mybashprofile. Mine just looks like this right now: #!/bin/bash alias ll='ls -AFlh' This way you don't have to reboot when you make changes to /boot/config/mybashprofile. 1 Quote Link to comment
fluisterben Posted September 1, 2022 Share Posted September 1, 2022 On 4/9/2019 at 7:47 PM, shEiD said: What I want to add to my .bash_profile: # History ignore and erase dupes export HISTCONTROL=ignoreboth:erasedups # Aliases alias lir="ls -liR" alias nolinks="find . -type f -links 1 -print" alias efd='bash /mnt/user/temp/scripts/empty-folders-delete' alias efp='bash /mnt/user/temp/scripts/empty-folders-print' alias fsf='bash /mnt/user/temp/scripts/find-samefile/batch-find-samefile' I'm asking, because I would really like to aliases and have nice history. I don't get it, you ignore bash history, and then want to have nice history? Quote Link to comment
pervel Posted September 2, 2022 Share Posted September 2, 2022 6 hours ago, fluisterben said: I don't get it, you ignore bash history, and then want to have nice history? He is not ignoring history. Look at the documentation for HISTCONTROL if you're curious what is going on. Quote Link to comment
fluisterben Posted September 13, 2022 Share Posted September 13, 2022 On 9/2/2022 at 4:23 AM, pervel said: He is not ignoring history. Look at the documentation for HISTCONTROL if you're curious what is going on. Well, could have fooled me, because it says; Quote # History ignore and erase dupes export HISTCONTROL=ignoreboth:erasedups Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.