Scripts:copie de cd
De Lowgeek wiki
Voici un exemple de script réalisant une copie de CD à CD
Ce script n'est pas de moi, mais je ne sait plus où je l'ai trouvé sur le net
<syntaxhighlight lang="bash">
- !/bin/bash
- copy-cd.sh: copying a data CD
CDROM=/dev/cdrom # CD ROM device OF=/home/bozo/projects/cdimage.iso # output file
- /xxxx/xxxxxxx/ Change to suit your system.
BLOCKSIZE=2048 SPEED=2 # May use higher speed if supported.
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=0,0 $OF
- Uses Joerg Schilling's "cdrecord" package (see its docs).
- http://www.fokus.gmd.de/nthp/employees/schilling/cdrecord.html
echo; 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 answer
case "$answer" in [yY]) rm -f $OF
echo "$OF erased." ;;
- ) echo "$OF not erased.";;
esac
echo
- Exercise:
- Change the above "case" statement to also accept "yes" and "Yes" as input.
exit 0 </syntaxhighlight>