I wonder if there is a way to create a 'virtual file' from a bash output.
Example:
Let's say I want to email the output of mysqldump
as an attachment to an external email address.
I can use Mutt to do so.
The mutt
option I need to use is -a <name of the file I want to attach>
.
I know I could use a temporary file:
mysqldump mysqldumpoptions > /tmp/tempfile && mutt -a /tmp/tempfile admin@example.org
But I would rather redirect the mysqldump
output directly to Mutt instead.
Mutt's -a
option only accepts a file and not a stream,
but maybe there is a way to pass it some kind of virtual file descriptor or something along those lines.
Something like:
mutt -a $(mysqldump mysqldumpoptions) admin@example.org
Is it possible? If not, why?
This is maybe a silly example and there surely are easier ways to do this, but I hope it explains my question about creating a virtual file from the output of another command.