diff --git a/bashrc.d/always_screen b/bashrc.d/always_screen new file mode 100644 index 0000000..6bcea49 --- /dev/null +++ b/bashrc.d/always_screen @@ -0,0 +1,23 @@ +#!/bin/bash +# Create a Screen session everytime, unless you don't want + +if [ -n "$(which screen)" ]; then + if [ -n "${STY}" ]; then + echo "This is screen session '${STY//[0-9]*\./}'" + else + echo "This is not a screen session, let's create one. Name of the session?" + read -r session_name + if [ -n "${session_name}" ] && [ "${session_name}" != "" ]; then + if [ -n "$(which xtitle)" ]; then + xtitle "${session_name}" + else + echo "xtitle is not installed so I can't update the title of the X window with the session name. Install it and the experience will be better)" + fi + screen -t "${session_name}" -S "${session_name}" && exit + else + echo "Ok, I'll leave you alone without a session..." + fi + fi +else + echo "Screen is not installed. Install it so always_screen in your bashrc will work." +fi diff --git a/bashrc.d/gpg_ssh b/bashrc.d/gpg_ssh new file mode 100644 index 0000000..730a5a8 --- /dev/null +++ b/bashrc.d/gpg_ssh @@ -0,0 +1,5 @@ +#!/bin/bash +# GPG and SSH +SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +export SSH_AUTH_SOCK +gpgconf --launch gpg-agent diff --git a/bashrc.d/kubectl_completion b/bashrc.d/kubectl_completion new file mode 100644 index 0000000..42a9921 --- /dev/null +++ b/bashrc.d/kubectl_completion @@ -0,0 +1,5 @@ +#!/bin/bash +if [ "$(which kubectl)" != "" ]; then + # shellcheck disable=SC1090 + source <(kubectl completion bash) +fi diff --git a/bashrc.d/terraform_completion b/bashrc.d/terraform_completion new file mode 100644 index 0000000..401e645 --- /dev/null +++ b/bashrc.d/terraform_completion @@ -0,0 +1,2 @@ +#!/bin/bash +complete -C /usr/bin/terraform terraform diff --git a/bashrc.d/wsl_return_home b/bashrc.d/wsl_return_home new file mode 100644 index 0000000..a17a924 --- /dev/null +++ b/bashrc.d/wsl_return_home @@ -0,0 +1,8 @@ +#!/bin/bash +# Windows Subsystem for Linux start in the +# Windows profile folder, but this change +# it to change to the WSL home folder instead + +if [ -n "${WSL_DISTRO_NAME}" ]; then + cd "${HOME}" ||exit 1 +fi diff --git a/install_my_bashrc.sh b/install_my_bashrc.sh new file mode 100755 index 0000000..24ebc5f --- /dev/null +++ b/install_my_bashrc.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +my_dir=$(dirname "${0}") + +if [ -e "${HOME}/.bashrc" ]; then + mv "${HOME}/.bashrc" "${HOME}/.bashrc.bak" +fi +cp "${my_dir}/bash_rc" "${HOME}/.bashrc" -rfp +cp "${my_dir}/bashrc.d" "${HOME}/.bashrc.d" -rfp