-
-
Save xorspark/736bcfea5089aa93d434b2341d2c376b to your computer and use it in GitHub Desktop.
y U nO MoCk? Mocking text filter that I use from within vim. Because reasons.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# makes mocking alt caps text from stdin | |
upper=0 | |
while IFS= read -N 1 line; do | |
if [[ "$line" =~ [[:space::]] ]]; then | |
printf "%s" "$line" | |
elif (( upper == 0 )); then | |
printf "%s" "${line,}" | |
upper=1 | |
else | |
printf "%s" "${line^}" | |
upper=0 | |
fi | |
done <&0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment