Error in bashrc Garuda Linux Mokka

Good evening, gentlemen!

I’m trying to run the source ~/.bashrc command through fish, but I’m getting the error below.
Does anyone know what it could be?

Error:

󰛓 ❯ source ~/.bashrc
~/.bashrc (line 38): Missing end to balance this if statement
if [[ -x /usr/bin/bat ]]; then
^^
from sourcing file ~/.bashrc
source: Error while reading file “/home/kyo1506/.bashrc”

bashrc:

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

# Load starship prompt if starship is installed
if [ -x /usr/bin/starship ]; then
__main() {
local major="${BASH_VERSINFO[0]}"
local minor="${BASH_VERSINFO[1]}"

if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
source <("/usr/bin/starship" init bash --print-full-init)
else
source /dev/stdin <<<"$("/usr/bin/starship" init bash --print-full-init)"
fi
}
__main
unset -f __main
fi

# Advanced command-not-found hook
if [[ -f /usr/share/doc/find-the-command/ftc.bash ]]; then
  source /usr/share/doc/find-the-command/ftc.bash
fi


## Useful aliases

# Replace ls with eza
if [[ -x /usr/bin/eza ]]; then
  alias ls='eza -al --color=always --group-directories-first --icons'     # preferred listing
  alias la='eza -a --color=always --group-directories-first --icons'      # all files and dirs
  alias ll='eza -l --color=always --group-directories-first --icons'      # long format
  alias lt='eza -aT --color=always --group-directories-first --icons'     # tree listing
  alias l.='eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles
fi

# Replace some more things with better alternatives
if [[ -x /usr/bin/bat ]]; then
  alias cat='bat --style header --style snip --style changes --style header'
fi

[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru'

# Common use
alias grubup="sudo update-grub"
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias rmpkg="sudo pacman -Rdd"
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias upd='/usr/bin/garuda-update'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='ugrep --color=auto'
alias fgrep='ugrep -F --color=auto'
alias egrep='ugrep -E --color=auto'
alias hw='hwinfo --short'                          # Hardware Info
alias big="expac -H M '%m\t%n' | sort -h | nl"     # Sort installed packages according to size in MB (expac must be installed)
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
alias ip='ip -color'

# Get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"

# Help people new to Arch
alias apt='man pacman'
alias apt-get='man pacman'
alias please='sudo'
alias tb='nc termbin.com 9999'
alias helpme='cht.sh --shell'
alias pacdiff='sudo -H DIFFPROG=meld pacdiff'

# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)'

# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"

# Recent installed packages
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"

My OS Config:

Operating System: Garuda Linux 
KDE Plasma Version: 6.4.4
KDE Frameworks Version: 6.17.0
Qt Version: 6.9.1
Kernel Version: 6.15.9-zen1-1.1-zen (64-bit)
Graphics Platform: Wayland

Thank you in advance for your attention and help!

Fish is not compatible with syntax from bash.
These error is a “fish” error.
The .bash_profile file is intended only to be executed (sourced) by the bash shell. fish is a different shell, with different syntax

3 Likes

Welcome to the forums!

In your terminal, execute

bash

and then execute

source ~/.bashrc

Do you still get the error?

4 Likes

Sorry for my stupidity. I really needed to research more about this error. Yes, after I ran the bash, the command was successfully executed. Thank you for your help!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.