making script work from a curl command (hopefully)