copy-cd.sh

来自「Shall高级编程」· Shell 代码 · 共 52 行

SH
52
字号
#!/bin/bash# copy-cd.sh: copying a data CDCDROM=/dev/cdrom                           # CD ROM deviceOF=/home/bozo/projects/cdimage.iso         # output file#       /xxxx/xxxxxxx/                     Change to suit your system.BLOCKSIZE=2048SPEED=2                                    # May use higher speed if supported.DEVICE=cdrom# DEVICE="0,0"    on older versions of cdrecord.echo; echo "Insert source CD, but do *not* mount it."echo "Press ENTER when ready. "read ready                                 # Wait for input, $ready not used.echo; echo "Copying the source CD to $OF."echo "This may take a while. Please be patient."dd if=$CDROM of=$OF bs=$BLOCKSIZE          # Raw device copy.echo; echo "Remove data CD."echo "Insert blank CDR."echo "Press ENTER when ready. "read ready                                 # Wait for input, $ready not used.echo "Copying $OF to CDR."cdrecord -v -isosize speed=$SPEED dev=$DEVICE $OF# Uses Joerg Schilling's "cdrecord" package (see its docs).# http://www.fokus.gmd.de/nthp/employees/schilling/cdrecord.htmlecho; echo "Done copying $OF to CDR on device $CDROM."echo "Do you want to erase the image file (y/n)? "  # Probably a huge file.read answercase "$answer" in[yY]) rm -f $OF      echo "$OF erased."      ;;*)    echo "$OF not erased.";;esacecho# Exercise:# Change the above "case" statement to also accept "yes" and "Yes" as input.exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?