Glavin001 / Glavin001/dotfiles

Verify if bashrc on Mac is already loaded in bash_profile

Open
#7 0 comments 0 reactions 1 assignee Claimed by @Glavin001 View on GitHub
enhancement
Dominant language
Vim Script
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

See http://stackoverflow.com/a/4749368/2578205

``` bash
echo "=== Configuring Bash_Profile to load Bashrc ==="
sourceBashrc="source ~/.bashrc"
if grep -Fxq "$sourceBashrc" ~/.bash_profile
then
# code if found
echo "Bashrc correctly setup."
else
# code if not found
echo "Your bash_profile is missing bash_rc."
read -p "Would you like to automatically configure it now? (y/N) " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# do dangerous stuff
echo "$sourceBashrc" >> ~/.bash_profile
fi

fi
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.