#!/usr/bin/env bash
#
#   bash-rcc - source ~/.bashrc and run bash -c command
#
#   This is used as the shell by programs such as vim where we want
#   `:!` commands to be able to use shell functions and aliases
#   defined in `~/.bashrc` but do not want the shell started in
#   interactive mode. Interactive mode does various things, such as
#   setting up its own process group, that can cause problems when
#   used to run a single command from another program.

use_bashrc=true
. ~/.bashrc -i -c
while [[ $1 = -c || $1 = -i ]]; do  shift; done
eval "$1"
ret=$?

if [[ $ret != 0 ]]
then
	echo -e "\e[91;1mReturn $ret\e[0m"
fi
