relpipe-data/examples/relpipe-out-fstab.sh
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 01:21:22 +0100
branchv_0
changeset 330 70e7eb578cfa
parent 317 fce3d6290c40
permissions -rwxr-xr-x
Added tag relpipe-v0.18 for changeset 5bc2bb8b7946

#!/bin/bash

(
	# Just troll-in the first record:
	relpipe-in-cli \
		--relation "Heathers" \
			--attribute "Duke" string \
			--attribute "McNamara" string \
			--attribute "Chandler" string \
			--attribute "Veronica" string \
			--attribute "J.D." string \
			--attribute "Big" string \
			--attribute "Fun" string \
			--record \
		'' '# <file system>' '<mount point>' '<type>' '<options>' '<dump>' '<pass>';
		# relpipe-out-nullbyte processes only attribute values
	# Read the actual pipe's input:
	cat
)	| relpipe-out-nullbyte \
	| xargs --null --max-args=7 perl -e \
		'printf("%-*s %-*s %-*s %-*s %-*s %s\n",
			# following numbers define paddings:
			50, ($ARGV[0] eq "" ? $ARGV[1] : "$ARGV[0]=$ARGV[1]"),
			40, ($ARGV[2] eq "" ? "none" : $ARGV[2]),
			16, $ARGV[3],
			50, $ARGV[4],
			 8, $ARGV[5],
			    $ARGV[6]
		);'