[COFF] Shell script advice: using 'dd' to write multiple media
Ralph Corderoy
ralph at inputplus.co.uk
Tue Jun 27 16:23:16 AEST 2023
Hi Steve,
> I’ve never figured out how to use ‘dd’ so it returns after a single
> block is written doesn’t close the input, killing the pipeline, or
> cause the rest of the data to be discarded.
I think this meets your description and complies with POSIX's dd(1p)
here.
$ seq 33 126 | sed 's/$/P/' | dc |
> while :; do
> LC_ALL=C dd bs=10 count=1 2>dd.err | sed -n l
> grep -q '^[^0].* records in$' dd.err || break
> done
!"#$%&'()*$
+,-./01234$
56789:;<=>$
?@ABCDEFGH$
IJKLMNOPQR$
STUVWXYZ[\\$
]^_`abcdef$
ghijklmnop$
qrstuvwxyz$
{|}~$
$
$ rm dd.err
I set the locale so the format of dd's stderr report is known.
--
Cheers, Ralph.
More information about the COFF
mailing list