Linux › Section K · Shell scripts › Topic K.5
Temporary files and here documents
Scripts often need scratch space for intermediate results and a tidy way to write out blocks of text. mktemp gives safe, unique temporary files, trap makes sure they are cleaned up however the script ends, and here documents feed whole paragraphs of text to a command.
In this topic
- Why temporary files need care
- mktemp
- trap: run commands when the script ends
- Worked example: a self-cleaning script
- More uses of trap
- Here documents
- Quoted markers, tabs and here-strings
- Worked example: generating a configuration file
- Common mistakes to avoid
- Key takeaways
This topic is part of Wuanberri Pro. Checking your access…
