Update README for installer

This commit is contained in:
dig 2019-03-02 21:25:53 +01:00
parent 0dfc76bd1a
commit 00c9868ebd
1 changed files with 13 additions and 5 deletions

View File

@ -1,11 +1,19 @@
# shtpl # shtpl
> sh templating > bash templating
## Install ## Install
Put the `shtpl` script somewhere meant for executable scripts like `~/bin/shtpl`. Clone or download this repository:
`git clone $p2git/dig/bash-utils.git`
Put the `shtpl` script somewhere meant for executable scripts like `/usr/local/bin/shtpl`.
Make it executable: `chmod +x shtpl`. Make it executable: `chmod +x shtpl`.
or let the installer do it for you :)
`bash-utils/shtpl/install`
## Usage ## Usage
Create a template file to be executed with shtpl: Create a template file to be executed with shtpl:
@ -14,7 +22,7 @@ Create a template file to be executed with shtpl:
nano someTpl.shtpl nano someTpl.shtpl
``` ```
``` ```
#!/path/to/shtpl #!/usr/bin/env shtpl
Hello $WHO ! Hello $WHO !
``` ```
@ -51,7 +59,7 @@ WHO=Doctor ./someTpl.shtpl > doctorGreetings.txt
shtpl uses a hack to turn you file into a call of `echo "<your file here>"`, so it is simple, all what your system is able to understand as substitution is valid ! shtpl uses a hack to turn you file into a call of `echo "<your file here>"`, so it is simple, all what your system is able to understand as substitution is valid !
``` ```
#!/path/to/shtpl #!/usr/bin/env shtpl
Simple variable: $ENV_VAR , and with brackets: ${TOTO}cm² Simple variable: $ENV_VAR , and with brackets: ${TOTO}cm²
Sub commands: $(echo ok) Sub commands: $(echo ok)
@ -85,4 +93,4 @@ Prompt user input in place: your input
Loops: [0][1][2][3][4][5][6][7][8][9][10] Loops: [0][1][2][3][4][5][6][7][8][9][10]
Call sub templates: what the template returns with "aze" Call sub templates: what the template returns with "aze"
``` ```