relpipe-data/examples/relpipe-out-fstab.sh
author František Kučera <franta-hg@frantovo.cz>
Tue, 04 Dec 2018 22:33:36 +0100
branchv_0
changeset 180 d342de2e09a4
child 194 cd5524d03739
permissions -rwxr-xr-x
examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
180
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#!/bin/bash
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
(
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
	# Just troll-in the first record:
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
	relpipe-in-cli generate Heathers 7 \
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
		Duke string McNamara string Chandler string Veronica string J.D. string \
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
		Big string Fun string \
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
		'' '# <file system>' '<mount point>' '<type>' '<options>' '<dump>' '<pass>';
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
		# relpipe-out-nullbyte processes only attribute values
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
	# Read the actual pipe's input:
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
	cat
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
)	| relpipe-out-nullbyte \
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
	| xargs --null --max-args=7 perl -e \
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
		'printf("%-*s %-*s %-*s %-*s %-*s %s\n",
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
			# following numbers define paddings:
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
			50, ($ARGV[0] eq "" ? $ARGV[1] : "$ARGV[0]=$ARGV[1]"),
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
			40, ($ARGV[2] eq "" ? "none" : $ARGV[2]),
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
			16, $ARGV[3],
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
			50, $ARGV[4],
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
			 8, $ARGV[5],
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
			$ARGV[6]
d342de2e09a4 examples: fstab formatting using -in-fstab, -out-nullbyte, xargs and Perl
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
		);'