Update readme, add sources and move some things to the folder
This commit is contained in:
parent
27f02aaf9c
commit
8a3e194140
7 changed files with 63 additions and 32 deletions
|
@ -1,2 +1,7 @@
|
|||
# my_bashrc
|
||||
My Bash RC file
|
||||
|
||||
My Bash RC file. With the posibility to add more files from a ~/.bashrc.d folder and to install more, from git repositories (in the *sources* file).
|
||||
|
||||
# Installation
|
||||
|
||||
Run install_my_bashrc.sh as the user you want to install it, or give an existing folder as parameter to install it somewhere else (/etc/skel for example).
|
||||
|
|
27
bash_rc
27
bash_rc
|
@ -18,29 +18,6 @@ fi
|
|||
|
||||
export PATH="${PATH}:${HOME}/bin:/usr/local/bin:/usr/local/sbin"
|
||||
|
||||
export EDITOR=nano
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "${HOME}/.bashrc_ps1"
|
||||
|
||||
# Format history records
|
||||
export HISTTIMEFORMAT="[%s] "
|
||||
|
||||
# Append to history file
|
||||
#PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
||||
|
||||
# Share between shells
|
||||
#PROMPT_COMMAND="history -c; history -r; $PROMPT_COMMAND"
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
# Unlimited history
|
||||
export HISTFILESIZE=
|
||||
export HISTSIZE=
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
@ -110,9 +87,9 @@ fi
|
|||
mkdir -p "${HOME}/.screen"
|
||||
export SCREENDIR="${HOME}/.screen"
|
||||
|
||||
# Set other bashrc files
|
||||
# Source other RC files
|
||||
mkdir -p "${HOME}/.bashrc.d"
|
||||
for bashrc_file in $(find "${HOME}/.bashrc.d" -type f | sort | grep -v ~$)
|
||||
for bashrc_file in $(find "${HOME}/.bashrc.d" -type f | grep -v '\.bak$' |grep -v '~$' | sort)
|
||||
do
|
||||
if [ -n "${bashrc_file}" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
|
|
18
bashrc.d/history_options
Normal file
18
bashrc.d/history_options
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# Format history records
|
||||
export HISTTIMEFORMAT="[%s] "
|
||||
|
||||
# Append to history file
|
||||
#PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
||||
|
||||
# Share between shells
|
||||
#PROMPT_COMMAND="history -c; history -r; $PROMPT_COMMAND"
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
# Unlimited history
|
||||
export HISTFILESIZE=
|
||||
export HISTSIZE=
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
2
bashrc.d/nano_editor
Normal file
2
bashrc.d/nano_editor
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
export EDITOR=nano
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/bash
|
||||
if [ -x /usr/bin/terraform ]; then
|
||||
complete -C /usr/bin/terraform terraform
|
||||
fi
|
||||
|
|
|
@ -2,10 +2,32 @@
|
|||
|
||||
my_dir=$(dirname "${0}")
|
||||
|
||||
if [ -e "${HOME}/.bashrc" ]; then
|
||||
mv "${HOME}/.bashrc" "${HOME}/.bashrc.bak"
|
||||
if [ -n "${1}" ]; then
|
||||
install_directory="${1}"
|
||||
if [ ! -d "${install_directory}" ]; then
|
||||
echo "The given install directory '${install_directory}' does NOT exists."
|
||||
exit 2
|
||||
fi
|
||||
echo "Installing in '${install_directory}' folder instead of \$HOME"
|
||||
else
|
||||
install_directory="${HOME}"
|
||||
fi
|
||||
|
||||
if [ -e "${install_directory}/.bashrc" ]; then
|
||||
mv "${install_directory}/.bashrc" "${install_directory}/.bashrc.bak"
|
||||
fi
|
||||
cd "${my_dir}" ||exit 1
|
||||
cp bash_rc "${HOME}/.bashrc" -rfp
|
||||
mkdir -p "${HOME}/.bashrc.d/"
|
||||
cp bashrc.d/* "${HOME}/.bashrc.d/" -rfp
|
||||
cp bash_rc "${install_directory}/.bashrc" -rfp
|
||||
mkdir -p "${install_directory}/.bashrc.d/"
|
||||
cp bashrc.d/* "${install_directory}/.bashrc.d/" -rfp
|
||||
if [ -e "${my_dir}/sources}" ]; then
|
||||
mkdir -p "${install_directory}/src/"
|
||||
while read -r source
|
||||
do
|
||||
source_name=$(basename "${source}" .git)
|
||||
git clone "${source}" "${install_directory}/src/${source_name}" --depth 1
|
||||
if [ -e "${install_directory}/src/${source_name}/install.sh" ]; then
|
||||
bash "${install_directory}/src/${source_name}/install.sh"
|
||||
fi
|
||||
done <<< "$(sed 's/#.*$//g' "${my_dir}/sources")"
|
||||
fi
|
||||
|
|
5
sources
Normal file
5
sources
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Add (or remove) sources repositories
|
||||
# The repository will be cloned to ~/src and
|
||||
# if there is an install.sh script in the root
|
||||
# of the repository, it will be run (so be careful)
|
||||
https://github.com/ajdelgado/bash_prompt.git
|
Loading…
Reference in a new issue