changed lsb_release -si to distribution()

I use EndeavourOS and lsb_release -si returns as such Soo it doesnt match Arch on my OS, And theres already a defined function which returns the distribution so changed to that and now it works cat is aliased for bat on endeeavourOS and any arch or redhat system hopefully.
This commit is contained in:
Dayyan
2024-07-16 08:32:19 +05:30
committed by GitHub
parent b461a26e03
commit aac6650798

32
.bashrc
View File

@@ -71,17 +71,17 @@ alias snano='sedit'
alias vim='nvim'
# Replace batcat with cat on Fedora as batcat is not available as a RPM in any form
if command -v lsb_release >/dev/null; then
DISTRIBUTION=$(lsb_release -si)
else
DISTRIBUTION=$(cat /etc/os-release | grep ^ID= | cut -d'=' -f2)
fi
if [ "$DISTRIBUTION" = "Fedora" ] || [ "$DISTRIBUTION" = "Arch" ]; then
alias cat='bat'
else
alias cat='batcat'
fi
#if command -v lsb_release >/dev/null; then
# DISTRIBUTION=$(lsb_release -si)
#else
# DISTRIBUTION=$(cat /etc/os-release | grep ^ID= | cut -d'=' -f2)
#fi
#
#if [ "$DISTRIBUTION" = "Fedora" ] || [ "$DISTRIBUTION" = "Arch" ]; then
# alias cat='bat'
#else
# alias cat='batcat'
#fi
# To have colors for ls and all grep commands such as grep, egrep and zgrep
export CLICOLOR=1
@@ -429,6 +429,14 @@ distribution () {
echo $dtype
}
DISTRIBUTION=$(distribution)
if [ "$DISTRIBUTION" = "redhat" ] || [ "$DISTRIBUTION" = "arch" ]; then
alias cat='bat'
else
alias cat='batcat'
fi
# Show the current version of the operating system
ver() {
local dtype
@@ -637,4 +645,4 @@ fi
export PATH=$PATH:"$HOME/.local/bin:$HOME/.cargo/bin:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin"
eval "$(starship init bash)"
eval "$(zoxide init bash)"
eval "$(zoxide init bash)"