fixed typo in bashrc path, variabilized bashrc path

This commit is contained in:
Bryan Joshua Pedini 2023-12-14 15:13:51 +01:00
parent bcaffe612c
commit c53a382a4f

View File

@ -6,9 +6,10 @@ CURRENT_FANCYFY=""
DELETE=false
MOVE=false
PRESENT=false
BASHRC="~/.bashrc"
_bashrc_present() {
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ${BASHRC})" ]; then
echo true
exit
fi
@ -18,7 +19,7 @@ _bashrc_present() {
_arguments() {
if [ "$(_bashrc_present)" = true ]; then
PRESENT=true
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY /home/bryanpedini/.bashrc | sed 's/.*=//')"
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ${BASHRC} | sed 's/.*=//')"
fi
for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then
@ -43,7 +44,7 @@ _help() {
echo " --force"
echo " Force the reinstallation of the files"
echo " --delete"
echo " Delete the reference in ~/.bashrc"
echo " Delete the reference in ${BASHRC}"
echo " --move"
echo " Create a new reference if the location of this folder has been changed"
echo " --server"
@ -52,13 +53,13 @@ _help() {
}
_delete() {
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' "${BASHRC}"
}
_bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
echo "#REF:bashrc_overrides:REF" >> "${BASHRC}"
echo "export TERMINAL_FANCYFY=${1}" >> "${BASHRC}"
echo ". ${THIS}/bashrc_overrides/_all" >> "${BASHRC}"
}
_move() {
@ -86,7 +87,7 @@ _main() {
fi
elif [ "${PRESENT}" = true ]; then
if [ "${CURRENT_FANCYFY}" != "${FANCYFY}" ]; then
sed -i "s/TERMINAL_FANCYFY=${CURRENT_FANCYFY}/TERMINAL_FANCYFY=${FANCYFY}/" ~/.bashrc
sed -i "s/TERMINAL_FANCYFY=${CURRENT_FANCYFY}/TERMINAL_FANCYFY=${FANCYFY}/" "${BASHRC}"
echo "customized fancyfying"
echo
else