Skip to content

Instantly share code, notes, and snippets.

@capotej
Created November 22, 2010 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save capotej/709493 to your computer and use it in GitHub Desktop.
Save capotej/709493 to your computer and use it in GitHub Desktop.
makes string safe to grep for ps auxwww
# turns hey => "[h]ey"
def grep_safe(path)
"[#{path.chars.first}]#{path.chars.to_a.slice(1, path.chars.count).join}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment