学习资料:bash中文手册+举例
- wanglei8312
- 帖子: 45
- 注册时间: 2007-07-06 15:40
不错,学习了.
#!/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.iso
CONTENTSFILE=contents
DEVICE=cdrom
# DEVICE="0,0" For older versions of cdrecord
DEFAULTDIR=/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.
Advanced Bash-Scripting Guide
else
IMAGE_DIRECTORY=$1
fi
# 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_DIRECTORY
echo "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 $IMAGEFILE
exit $?
#!/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.iso
CONTENTSFILE=contents
DEVICE=cdrom
# DEVICE="0,0" For older versions of cdrecord
DEFAULTDIR=/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.
Advanced Bash-Scripting Guide
else
IMAGE_DIRECTORY=$1
fi
# 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_DIRECTORY
echo "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 $IMAGEFILE
exit $?
-
- 帖子: 80
- 注册时间: 2007-04-22 16:04
- blackiron
- 帖子: 887
- 注册时间: 2007-05-25 16:47
- 来自: 上海
Re: bash中文手册+举例
把这些文本考到OpenOffice 里,然后另存PDF多简单点事啊
-
- 帖子: 66
- 注册时间: 2007-11-20 10:51
-
- 帖子: 79
- 注册时间: 2007-06-08 22:43
-
- 帖子: 9
- 注册时间: 2007-11-06 17:27
- percy
- 帖子: 508
- 注册时间: 2006-09-10 8:19
- 系统: Gentoo/Mac OS X
- 来自: Shanghai,China
- 联系: