#!/bin/sh

# Quick'n'dirty contraption to scan Greasemonkey user files, and insert @require'd files.
# Works only with LOCAL FILES for now

requiredfile=`grep "@require" $1 | awk '{print $3}'`
outfile="out_"$1 	

# Insert $requiredfile after function() {  AND remove the @require line
sed -e '/function()/{
	N
	r '"$requiredfile"'
}; /@require/d' "$1" > "$outfile"