# `pp` a preprocessor `pp` allows embedding `sh` code in files of any type by nesting it inside the `#!\n` token, where `\n` is a new line. That means that if you'd like a simple loop or an `if` inside an HTML file for instance, you could use `pp`. ## Install On a Linux BSD or macOS machine, in a terminal, run: mkdir -p ~/src/mkws.sh cd ~/src/mkws.sh curl -s https://mkws.sh/pp/pp@1.0.12.tgz | tar -xzvf - cd pp make install PREFIX=$HOME ## Uninstall cd ~/src/mkws.sh/pp make uninstall PREFIX=$HOME ## Usage For the following code: pp example `pp` outputs: pp example ## Arguments You can also pass arguments to it by appending them to the command call: $1

#! echo $2 #!

Calling the above code with `pp tmp.upphtml 'pp example' 'hello, world'` will result in: pp example

hello world

## Pipes `pp`'s `stdin` is sent to the child [`sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) pp example

#! cat #!

`echo 'hello, world' | pp tmp.upphtml` will output: pp example

hello, world

## Debugging `pp` also takes an optional `-d` flag. If passed, `pp` will dump the generated [`sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) code instead of executing it: pp example `pp -d tmp.upphtml` will output: echo " pp example " ## Example pp Home #! addcls() { sed "s///g" } smu README | addcls #!

Files

Download

pp.tgz ## See also * * *