Simplify cat-highlight

This commit is contained in:
tastytea 2022-03-18 16:21:29 +01:00
parent 283971e3ad
commit 0cd89f0788
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -33,9 +33,9 @@ function cat-highlight()
{
# Check if we are in a terminal and $LESSOPEN is not empty
if [[ -t 1 && -n "${LESSOPEN}" ]]; then
CATOPEN="${LESSOPEN/| }"
CATOPEN="${CATOPEN/ %s}"
\cat $@ | eval ${CATOPEN}
# Works only if command understands - as stdin
CATOPEN="${LESSOPEN/\%s/-}"
eval "\cat $@ ${CATOPEN}"
else
\cat $@
fi