2012年6月25日星期一

Checking whether a disk is in the CD-burner (soft-linked to /dev/hdc):

head -1 /dev/hdc

# head: cannot open '/dev/hdc' for reading: No medium found
# (No disc in the drive.)

# head: error reading '/dev/hdc': Input/output error
# (There is a disk in the drive, but it can't be read;
#+ possibly it's an unrecorded CDR blank.)

# Stream of characters and assorted gibberish
# (There is a pre-recorded disk in the drive,
#+ and this is raw output -- a stream of ASCII and binary data.)
# Here we see the wisdom of using 'head' to limit the output
#+ to manageable proportions, rather than 'cat' or something similar.

没有评论:

发表评论