ex40.sh

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

SH
47
字号
#!/bin/bash# ex40.sh (burn-cd.sh)# Script to automate burning a CDR.SPEED=2          # May use higher speed if your hardware supports it.IMAGEFILE=cdimage.isoCONTENTSFILE=contentsDEVICE=cdrom# DEVICE="0,0"     For older versions of cdrecordDEFAULTDIR=/opt  # This is the directory containing the data to be burned.                 # Make sure it exists.                 # Exercise: Add a test for this.# Uses Joerg Schilling's "cdrecord" package:# http://www.fokus.fhg.de/usr/schilling/cdrecord.html#  If this script invoked as an ordinary user, may need to suid cdrecord#+ chmod u+s /usr/bin/cdrecord, as root.#  Of course, this creates a security hole, though a relatively minor one.if [ -z "$1" ]then  IMAGE_DIRECTORY=$DEFAULTDIR  # Default directory, if not specified on command line.else    IMAGE_DIRECTORY=$1fi# Create a "table of contents" file.ls -lRF $IMAGE_DIRECTORY > $IMAGE_DIRECTORY/$CONTENTSFILE# The "l" option gives a "long" file listing.# The "R" option makes the listing recursive.# The "F" option marks the file types (directories get a trailing /).echo "Creating table of contents."# Create an image file preparatory to burning it onto the CDR.mkisofs -r -o $IMAGEFILE $IMAGE_DIRECTORYecho "Creating ISO9660 file system image ($IMAGEFILE)."# Burn the CDR.echo "Burning the disk."echo "Please be patient, this will take a while."cdrecord -v -isosize speed=$SPEED dev=$DEVICE $IMAGEFILEexit $?

⌨️ 快捷键说明

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