Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 2719  / 2 Years ago, mon, october 10, 2022, 4:34:10

As this post says, the ~/.bashrc is sourced automatically in Ubuntu 12.04 LTS Server, which I use.
I don't know where he got this information from, but as it is not downvoted yet, I believe it is true.



I used this script to check if it is sourced:



if [ -f ~/.bashrc ]; then
echo "Not sourced!";
fi


Just for info: Permissions at the moment are 775 and owner is me.



So why is my ~/.bashrc not sourced?


More From » 12.04

 Answers
6

As we found out, you have no .profile file in your home. Look at the bash's manual here for Bash startup files.



Make a .profile for yourself:



nano ~/.profile



Insert this text to that file (copied from Debian Squeeze):



# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi


Tip: if you are making a new user, use the -m switch to make him a dir, and place the default files, eg.: sudo useradd example -m -d /home/example


[#32512] Tuesday, October 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cklaceowne

Total Points: 228
Total Questions: 102
Total Answers: 111

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;