gn
As of 2025-02-12, I don't use this tool anymore due to the reasons mentioned here and because generating a website with only shell scripts can become hacky very quickly. Also, I made this a couple years ago when I had nothing to show on this website (wether this has changed or not is debatable), so even if this tool is too simple to be proud of, I put it here. I'm keeping this page around to remind myself of the good ol' days.
This is a small utility with one simple purpose: to read standard input and pass to /bin/sh any text that is between two percent signs. The result is printed to standard output with the result of the commands that were passed to the shell. Example:
$ echo "This is a file printed on %echo -n $(date +%%A)% by %whoami%" >file.txt $ gn <file.txt This is a file printed on Saturday by pevhs $
As you can see, percent signs that mustn't be interpreted must be doubled.
I used it to generate this website, as it allowed me to cat
header files and things
like that inside multiple files pretty easily. One should use it inside of a script as it cannot do
much on its own.
Other programs doing the same thing already exist, but I wanted to make my own. Of course, files could brick your machine or leak informations if they contain malicious scripts. Also, be wary of infinite loops.
Source.