samedi 29 novembre 2014

Map reading/writing a file to getting output from/sending input to a script?


Suppose I have two scripts, script1.sh and script2.sh. I am wondering if there is a way to make a filesystem interface such that, for example, I can go vim file and then have my system run script1.sh and have the output from the script inside my editor. Then, when I write the file, the system would send the modified text as piped input into script2.sh.


Is this possible? I've looked into using 'inotify', which could run my desired script when the file was changed. But I haven't figured out how to do the first part yet, where opening the file itself just gets the standard output from some script.



Aucun commentaire:

Enregistrer un commentaire