Skip to content

Instantly share code, notes, and snippets.

@alexolinux
Last active June 27, 2025 15:06
Show Gist options
  • Save alexolinux/c88f6882bf781beb1242c26b0a713c25 to your computer and use it in GitHub Desktop.
Save alexolinux/c88f6882bf781beb1242c26b0a713c25 to your computer and use it in GitHub Desktop.
ccat package installation.
#!/bin/bash
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# https://github.com/owenthereal/ccat/releases
CCAT_VER="1.1.0"
BIN_DIR="${HOME}/.local/bin"
check_dir(){
if [ ! -d "${BIN_DIR}" ]; then
mkdir -p "${BIN_DIR}"
fi
}
clear
if [ -z "$(command -v ccat)" ]; then
echo -e "${GREEN}Installing ccat...${NC}"
curl -fsSL https://github.com//owenthereal/ccat/releases/download/v${CCAT_VER}/linux-amd64-${CCAT_VER}.tar.gz -o /tmp/linux-amd64-${CCAT_VER}.tar.gz
if [ "$?" -ne 0 ]; then
echo -e "${RED}Download failed. Check URL or Binary version availability.${NC}"
exit 1
else
echo -e "${GREEN}Successful download. Starting ccat installation...${NC}"
tar -xzvf /tmp/linux-amd64-${CCAT_VER}.tar.gz -C /tmp > /dev/null 2>&1
chmod +x /tmp/linux-amd64-${CCAT_VER}/ccat
check_dir
if [ "$?" -eq 0 ]; then
mv /tmp/linux-amd64-${CCAT_VER}/ccat "${BIN_DIR}/ccat"
"${BIN_DIR}/ccat" --version
echo -e "${GREEN}ccat installed successfully!${NC}"
rm -rf /tmp/linux-amd64-${CCAT_VER}
else
echo -e "${RED}It appears that an error has occurred. Check your PATH Variable.${NC}"
exit 1
fi
fi
else
echo -e "${GREEN}ccat is already installed! Nothing to do here. ${NC}"
ccat --version
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment