Skip to content

Instantly share code, notes, and snippets.

@airtonix
Last active December 16, 2015 22:19
Show Gist options
  • Save airtonix/5506188 to your computer and use it in GitHub Desktop.
Save airtonix/5506188 to your computer and use it in GitHub Desktop.
slugify for dash (the bash like interpreter on Ubuntu)
#!/bin/sh
#
# Installation
# mkdir ~/bin
# cd ~/bin
# wget http://gist.github.com/raw//5506188/slugify
# chmod +x ~/bin/slugify
#
# Usage
# $ lspci > ~/Desktop/pci-devices-$(slugify `date`).report
# ~/Desktop/pci-devices-fri-may-3-08-45-01-cst-2013.report
#
# $ slugify this That and Another
# this-that-and-another
echo $@ | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment