Is there a file type or method for using files in which certain files look and behave like symbolically linked files, but contain extra meta information for changing the data when they are read?
If I have a file called
hello-world.txt, and I build a symbolically linked file pointing to it,
ln -s /path/to/hello-world.txt /path/to/symlink
I can not change the contents of the
symlink without changing
hello-world.txt, as well as changing all of the other files that point to
hello-world.txt. I realize that symbolically/hard linked files are suppose to remain the same(because they are the same file in a sense), but it would be great, if I could write a file that references a particular file, and then also provides change details that get applied every time the file is read.
I tried to create my own file type using plain text that looked like this:
/path/to/file/being/referenced change statement change statement ...
I would then give these files their own file extension and mime type, and create an intermediate program to redirect to the referenced file, and basically try to mimic the behavior of a symbolic link. The problem is, the file doesn't "really" reference another file, and so actually reading the file(by using the cat command, or having a c++ processor pull in the file, etc), will not get the same information back that a symbolically linked file would. I'm not sure if I can provide a hook for this kind of thing, and have a program output the correct text for whatever is reading it. Maybe something with piped files? I dunno.
What would be the best way to achieve this kind of behavior on the file system?
Perhaps an analogy that best describes the kind of dynamic capabilities I want files to have, is how php files work on the web. The same file can be referenced using additional parameters, and that changes the contents of a file read by the user.