Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] Need help with .bash_profile

Featured Replies

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

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.

@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

 

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.

  • Author

@Delarius @ShoGinn thanks, guys - it worked perfectly 👍

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

  • 1 year later...
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?

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.

  • 2 weeks later...
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

 

 

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.