Skip to content

Instantly share code, notes, and snippets.

@tom-galvin
Created December 19, 2014 22:58
Show Gist options
  • Save tom-galvin/ef037bc4540cc8294071 to your computer and use it in GitHub Desktop.
Save tom-galvin/ef037bc4540cc8294071 to your computer and use it in GitHub Desktop.
DailyProgrammer Challenge #193e2
#!/bin/bash
declare -A SUBS=(
['lol']='laugh out loud' \
['dw']='don'\''worry' \
['hf']='have fun' \
['gg']='good game' \
['brb']='be right back' \
['g2g']='got to go' \
['wtf']='what the fuck' \
['wp']='well played' \
['gl']='good luck' \
['imo']='in my opinion')
read INPUT
eval "echo "$INPUT" | sed -r $(for ACR in "${!SUBS[@]}"; do printf " -e \"s/\\\\b$ACR\\\\b/${SUBS[$ACR]}/g\""; done)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment