There are ways to do this safely, but the simplest way would be to create the files in the current working directory or in a dedicated directory in the home directory. cat >dopythonstuff <<END ... END python dopythonstuff rm dopythonstuff