The Palkotools Development Blog contains information for developers and IT-professionals. It focuses on simple solutions for challenging problems.

Dienstag, 5. August 2014

Automate html creation with the linux dash

Overview

This article describes the basic concepts for html generation with the linux dash command interpreter.

Example: Video Collection

The dash command line interpreter can be used to generate video player websites for each video in a directory.

Example Video Collection

Dash commands

for - loop through files

Use the for-command to loop through every file. The example below loops through all mp4-files.

for filename in *.mp4;do echo $filename; done

The for-command can also be used to generate video thumbnails and background-images with a video formats converter.

while - loop through code lines

Use the while-command to loop through every line of a file. The example below will read the html template file template.html and loop trough all its lines and replace the SSI-variable *VARIABLE* by the dash variable $variable. In this example the output file is vidcenter.html.