fixed bashrc, removed variable, not working

This commit is contained in:
Bryan Joshua Pedini 2023-12-19 16:54:37 +01:00
parent dc984eb128
commit d792ce8809

View File

@ -6,10 +6,9 @@ CURRENT_FANCYFY=""
DELETE=false DELETE=false
MOVE=false MOVE=false
PRESENT=false PRESENT=false
BASHRC="~/.bashrc"
_bashrc_present() { _bashrc_present() {
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ${BASHRC})" ]; then if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
echo true echo true
exit exit
fi fi
@ -19,7 +18,7 @@ _bashrc_present() {
_arguments() { _arguments() {
if [ "$(_bashrc_present)" = true ]; then if [ "$(_bashrc_present)" = true ]; then
PRESENT=true PRESENT=true
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ${BASHRC} | sed 's/.*=//')" CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ~/.bashrc | sed 's/.*=//')"
fi fi
for PARM in "$@"; do for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then if [ "${PARM}" = "--server" ]; then
@ -53,13 +52,13 @@ _help() {
} }
_delete() { _delete() {
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' "${BASHRC}" sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc
} }
_bashrc_ref() { _bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> "${BASHRC}" echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo "export TERMINAL_FANCYFY=${1}" >> "${BASHRC}" echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc
echo ". ${THIS}/bashrc_overrides/_all" >> "${BASHRC}" echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
} }
_move() { _move() {
@ -87,7 +86,7 @@ _main() {
fi fi
elif [ "${PRESENT}" = true ]; then elif [ "${PRESENT}" = true ]; then
if [ "${CURRENT_FANCYFY}" != "${FANCYFY}" ]; 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 "customized fancyfying"
echo echo
else else