Skip to content

Instantly share code, notes, and snippets.

@atomicpages
Created February 4, 2026 22:50
Show Gist options
  • Select an option

  • Save atomicpages/e8e40d051252b1c935c6fd4425794edf to your computer and use it in GitHub Desktop.

Select an option

Save atomicpages/e8e40d051252b1c935c6fd4425794edf to your computer and use it in GitHub Desktop.
Mock someone's words
#!/bin/zsh
if [ -z "$1" ]; then
echo "Usage: $0 <text to convert>"
exit 1
fi
input="$*"
output=""
uppercase=0
for (( i=0; i<${#input}; i++ )); do
char="${input:$i:1}"
if [[ "$char" =~ [a-zA-Z] ]]; then
if [ $uppercase -eq 0 ]; then
output+="${char:l}"
uppercase=1
else
output+="${char:u}"
uppercase=0
fi
else
output+="$char"
fi
done
echo "$output" | pbcopy
echo "$output"
echo "(Copied to clipboard!)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment