In Vidar Holen's blog entry Useless Use of dd, he argues that dd
is
effectively useless, primarily because everything is a file and files can be piped.
We have also seen regularly on all the *nix sites the active discouragement of using cat
.
However, then Vidar puts forward this example:
# Rip a cdrom to a .iso file
cat /dev/cdrom > myfile.iso
...and I wonder, is it possible to do this without using cat
?
Obviously, the POSIX shell is presuming that the first group of chars is a command (hence "["="test", etc) which is unusual in modern languages with in-place operators. And, being as a shell is really an interpreter, why have we not got to the point where both cat
and dd
are redundant?
Are there any POSIX-based shells which have fully implemented in-place operators to the point where just /dev/cdrom > myfile.iso
would be enough to copy the data from a device to a file?
Or
Is there something in the POSIX specification which makes this kind of feature impossible?
Note that this question is slightly different from the UUOC question in that the example still uses a command at the beginning ("<") and not in-place operators. So it still conforms to the first-word-is-a-command rule.
(BTW, I personally like dd because, without it, speaking Welsh would be a lot less fun. :-p)
dd
can be used both at the filesystem level and at the raw disk sector/block level. For example, how would you usecp
make a copy of an MBR? Very easy to do usingdd
, i.e.dd if=/dev/sda of=mbr.backup bs=512 count=1
– fpmurphy Aug 20 '19 at 01:24<
is not a command. – muru Aug 20 '19 at 02:41