Created
September 22, 2011 08:14
-
-
Save malthe/1234308 to your computer and use it in GitHub Desktop.
less.app in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d $1 ]; then | |
echo "Not a directory: $1" | |
exit -1 | |
fi | |
while read line; do | |
filename="$(basename $line)" | |
if [ "${filename##*.}" == "less" ]; then | |
path="$(dirname $line)" | |
lessc -x "${line}" > \ | |
"${path}/../css/`echo ${filename} | cut -f1 -d. -`.css"; | |
fi; | |
done < <(inotifywait -r -q -m -e MODIFY --format '%w%f' $1); |
cool.
Note that instead of the mostly unreadable backticks, you can use $() when using bash.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome