[SOLVED] Need help with .bash_profile


6 posts in this topic Last Reply

Recommended Posts

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 by shEiD
Solved
Link to post

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.

Link to post

@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

 

Link to post

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.

Link to post
  • 1 year later...

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.

Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.