-
Notifications
You must be signed in to change notification settings - Fork 3
Examples
zstegi edited this page Oct 22, 2012
·
11 revisions
##Create /etc/network/interfaces out of a csv-file
####CSV-file content (here test.csv):
eth0;10.1.0.10;255.255.0.0;10.1.0.1
eth1;192.168.0.10; 255.255.255.0;192.168.0.1
####Template (here interfaces.tpl):
#% IFS=';'
#% while read "Val1" "Val2" "Val3" "Val4"; do
auto $Val1
iface $Val1 inet static
address $Val2
netmask $Val3
gateway $Val4
#% done < "$CSVFILE"
####Command:
$ CSVFILE=test.csv sh -c "$( tinytpl interfaces.tpl )"
####Result:
auto eth0
iface eth0 inet static
address 10.1.0.10
netmask 255.255.0.0
gateway 10.1.0.1
auto eth1
iface eth1 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
##Create an index.html from a folder and add it's content as links
####Template (index.html.tpl): <title>Directory listing for /$FOLDER/</title>
-
#% find
- $TEXT #% done
####Command: $ FOLDER=myfolder sh -c "$( tinytpl index.html.tpl )