Browse Source

Added shtpl utility

master
dig 3 years ago
parent
commit
7604d2bd7b
  1. 10
      shtpl/boucle.shtpl
  2. 11
      shtpl/shtpl
  3. 13
      shtpl/test.sh

10
shtpl/boucle.shtpl

@ -0,0 +1,10 @@
#!/home/dig/bin/shtpl
Coucou $WHO !
$(
for ((i=0 ; $nbrBoucle - $i ; i++))
do
echo "$i+100"
done
)

11
shtpl/shtpl

@ -0,0 +1,11 @@
#!/bin/bash
eval "echo \"$(cat $1 | sed '
1{ /#\!.*shtpl/ d }
s/"/\\"/g
')\""
#eval "echo \"$(perl -p -e 's/"/\\"/g' $1)\""

13
shtpl/test.sh

@ -0,0 +1,13 @@
# With env variables
## On single line
WHO=Doctor nbrBoucle=5 ./boucle.shtpl
## Multiline
WHO=Doctor \
nbrBoucle=5 \
./boucle.shtpl
# Save result to file
WHO=Doctor ./boucle.shtpl > final.txt
Loading…
Cancel
Save