relpipe-data/examples-validator.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 00:43:11 +0100
branchv_0
changeset 329 5bc2bb8b7946
parent 244 d4f401b5f90c
permissions -rw-r--r--
Release v0.18

<stránka
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
	
	<nadpis>Validating relational data</nadpis>
	<perex>check whether data are in the relpipe format</perex>
	<m:pořadí-příkladu>00500</m:pořadí-příkladu>

	<text xmlns="http://www.w3.org/1999/xhtml">
		
		<p>
			Just a passthrough command, so these pipelines should produce the same hash:
		</p>
		
		<m:pre jazyk="bash"><![CDATA[
relpipe-in-fstab | relpipe-tr-validator | sha512sum
relpipe-in-fstab | sha512sum]]></m:pre>

		<p>
			This tool can be used for testing whether a file contains valid relational data:
		</p>
		
		<m:pre jazyk="bash"><![CDATA[
if relpipe-tr-validator < "some-file.rp" &> /dev/null; then
	echo "valid relational data";
else
	echo "garbage";
fi]]></m:pre>
		
		<p>or as a one-liner:</p>
		
		<m:pre jazyk="bash"><![CDATA[relpipe-tr-validator < "some-file.rp" &> /dev/null && echo "ok" || echo "error"]]></m:pre>
		
		<p>
			If an error is found, it is reported on STDERR. So just omit the <code>&amp;</code> in order to see the error message.
		</p>
		
	</text>

</stránka>