What I want is this:
Having a file called file
somewhere in the filesystem with a content something like:
#!/bin/whatever-interpreter-you-want
echo 'line1'
echo 'line2'
When ANY (almost any since must exist a way to edit the script itself) program opens file
to read it gets:
line1
line2
As its contents instead of:
#!/bin/whatever-interpreter-you-want
echo 'line1'
echo 'line2'
Something like file contents being executed on the fly by the filesystem or the kernel itself (please, no cron, no inotify, no duct tape).
/etc/
full of these scripts querying such database when a daemon (or another program) opens them for reading. I've discarded cron because I want the files contents being generated just before they are opened, and I don't want a daemon regenerating these files from time to time. I don't know if applicable, but I discarded inotify too because I consider it very linux-specific. – matihus Aug 12 '15 at 19:23