recursive html2haml

Posted by yaya3 on Stack Overflow See other posts from Stack Overflow or by yaya3
Published on 2010-06-09T11:01:11Z Indexed on 2010/06/09 11:32 UTC
Read the original article Hit count: 448

Filed under:
|

I have many html files in nested directories which I need to convert to Haml templates I've modified the following bash script from here - http://terrbear.org/?p=277 to modify html files and not erb but I still need to modify it to be recursive ...

#!/bin/bash
if [ -z "$1" ]; then
    wdir="."
else
    wdir=$1
fi

for f in $( ls $wdir/*.html ); do
    out="${f%}.haml"
    if [ -e $out ]; then
        echo "skipping $out; already exists"
    else
        echo "hamlifying $f"
        html2haml $f > $out
    fi
done

I've named this script h2h.sh and tried going for commands like

h2h.sh `find . -type d`

I'm getting no output in the terminal

Thanks

© Stack Overflow or respective owner

Related posts about bash

Related posts about haml