Assume I like to execute the command foo which expects a specific file as an argument. I like to execute that command for a temporary purpose only so I like to have mentioned file as a temporary file, too.
In my specific use case I'd create the file temporary, execute the command with the temporary file and delete the file afterwards. This works fine.
Is there a way to pass that file with some kind of stream handler (borrowed speech from programming languages), so I don't have to create that file as a real file just temporary?
What I'm thinking about is some sort of foo "$( echo some content mimicking a file )", which I know, in fact, won't work but describes what I like to achieve.
Edit: My actual use case
I have multiple ansible roles to provision my entire system from scratch. Sometimes I have the need to run run one specific role for update purposes only. So actually I'm writing a temporary playbook, executing it and deleting it afterwards.
cat > ~/path/to/provisioning/scripts/tmp.yml << EOF
- name: Executing the tasks \`tmp\`
hosts: localhost
become: yes
roles:
- apt
- ${1}
EOF
ansible-playbook ~/path/to/provisioning/scripts/tmp.yml
rm ~/path/to/provisioning/scripts/tmp.yml