0

Below I am displaying the structure of my files, some of the code in each, and what I do to try and get it all sourced and ready to do.

STRUCTURE

~/
  .bash_profile
  .bashrc
  .profile

.bashrc

#-------------------------------------------------------------
# Source global definitions (if any)
#-------------------------------------------------------------
if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

.bash_profile

#
# # Setting PATH for Python 3.5
# # The orginal version is saved in .bash_profile.pysave
PATH="/bin:/usr/bin:/usr/local/bin" # Make sure to use double quotes not single quotes And on a new line 
export PATH

. /etc/profile
. ~/.git-completion.bash

if [ -f ~/bin/.bashrc ]; then
    . ~/bin/.bashrc   # --> Read ~/bashrc, if present.
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

# ENVIRONMENT VARIABLES

# add my ~/bin dir to path
PATH=${PATH}:~/bin
export PATH

# simple prompt
# default macOS prompt is: \h:\W \u\$
export PS1="\W \$ "

# enable Terminal color
export CLICOLOR=1

# Pretty colors
Default=$'\e[0m'
Italic=$'\e[3m'
Black=$'\e[30m'
Red=$'\e[31m'
Green=$'\e[32m'
Yellow=$'\e[33m'
Blue=$'\e[34m'
LightBlue=$'\e[36m'
Magenta=$'\e[35m'
Cyan=$'\e[36m'
White=$'\e[37m'
NewLine=$'\n'

.profile

#
# # Setting PATH for Python 3.5
# # The orginal version is saved in .bash_profile.pysave
PATH="/bin:/usr/bin:/usr/local/bin" # Make sure to use double quotes not single quotes And on a new line 
export PATH

# ENVIRONMENT VARIABLES

# add my ~/bin dir to path
PATH=${PATH}:~/bin
export PATH

# source files
source /etc/profile
source ~/.git-completion.bash
source ~/bin/.bash_profile
if [ -f ~/.bash_profile ]; then
  . ~/.bash_profile
fi
if [ -f ~/bin/.bashrc ]; then
    . ~/bin/.bashrc   # --> Read ~/bashrc, if present.
fi

if [ -f /etc/bashrc ]; then
    . /etc/bashrc   # --> Read /etc/bashrc, if present.
fi

# simple prompt
# default macOS prompt is: \h:\W \u\$
export PS1="\W \$ "

# enable Terminal color
export CLICOLOR=1

# Pretty colors
Default=$'\e[0m'
Italic=$'\e[3m'
Black=$'\e[30m'
Red=$'\e[31m'
Green=$'\e[32m'
Yellow=$'\e[33m'
Blue=$'\e[34m'
LightBlue=$'\e[36m'
Magenta=$'\e[35m'
Cyan=$'\e[36m'
White=$'\e[37m'
NewLine=$'\n'

When I go into Terminal.app or iTerm.app and try to run source with ~/.bashrc, ~/.bash_profile, or ~/.profile, it stalls and then eventually crashes. I'm not very familiar with setting all of this up, but I do know I need it to stop being a jerk, so any information about what I'm doing wrong, or what may be wrong with my setup would be greatly appreciated. If you just know how to fix this, that would be awesome too.

EDIT:

Following up on comment:

$ </proc/$$/cmdline tr '\0' '\n'
bash: /proc/93005/cmdline: No such file or directory

$ bash -i    <-[this stalls]

$ bash -li   <-[this stalls as well]

I don't care if I have to source this manually or not. I'd rather not source it manually, but I am not sure what else to do. I think that was just a last ditch effort to try and get all of this stuff working right for me.

Also, when I open up iTerm, bash doesn't really start well. I have to opt+C to be able to type any commands.

2
  • So bash starts but the problem occurs when you source one of these files manually (on demand), right? (0) Please confirm. (1) What is the output of </proc/$$/cmdline tr '\0' '\n'? (2) What happens when you (from within bash) run bash -i? (3) bash -li? (4) Why do you need to source manually? (this is rather unusual). // Please do not respond in comments, edit the question instead. Sep 21, 2019 at 6:26
  • @KamilMaciorowski I updated the post with my responses. Oct 1, 2019 at 15:33

0

You must log in to answer this question.

Browse other questions tagged .