Shell programming, avoiding tempfiles
Say I have the file
data.txt, and the command
cmd takes one argument, a file. Or, you could use
data.txt is uppercase, but
cmd only works if all data is lowercase.
Sure, you could do this
tr '[:upper:]' '[:lower:]' < data.txt > lowercase_data.txt cmd lowercase_data.txt rm lowercase_data.txt
But, is there a way to integrate this?
Like, a wrapper around the original file, that applies a filter, then passes a reference to the temporary file; the command is executed; last, the temporary file is deleted?
I use zsh.