xxwhirlpool
·
2026-03-20
catbin
1#!/usr/bin/env bash
2#
3# blatantly copied from evan hahn:
4# https://github.com/EvanHahn/dotfiles/blob/main/home/bin/bin/catbin
5
6if [[ $# -eq 0 ]]; then
7 echo "Usage: catbin [FILENAME]"
8 exit 1
9fi
10
11if [[ ! "$(command -v batcat)" ]]; then
12 cat_cmd="cat"
13else
14 export BAT_PAGER=""
15 cat_cmd="batcat"
16fi
17
18catfile=$(command -v "$1")
19
20[[ -f "$catfile" ]] && "$cat_cmd" "$catfile" || echo "$1 does not exist"