1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash outFile="$1"; shift; fileList="$@"; echo -n "Updating \"lozenge.js\"..." list=`echo ${fileList[@]} |\ sed -e 's/\(\S\+.html\) \?/"\1",/g'\ -e 's/^\(.*\),$/var files=[\1]/'` sed -i "s/var files=.*/$list/" "$outFile"; echo "Done."