Skip to content

Instantly share code, notes, and snippets.

@mystix
Created June 5, 2010 16:36
Show Gist options
  • Save mystix/426758 to your computer and use it in GitHub Desktop.
Save mystix/426758 to your computer and use it in GitHub Desktop.
JavaScript cleanup script
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 FILENAME"
exit 1
fi
# 1) convert file to unix line endings
# 2) converts tab characters to 4 spaces
# 3) collapse multi-line c-style comments, then strip them from source
# 4) trim trailing whitespace
#
# note: this script requires the reccoms.sh script as well
dos2unix < $1 | expand -t4 | ./remccoms.sh | sed 's/[ \t]*$//' > $1.tmp
mv $1.tmp $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment