Code Sample |
#!/bin/bash # Bash script for making CD-images out of files and/or directories easily. # Burned images should work with old CD drives as well with new ones # and with many OS:es too. # May not work if you specify multiple files/directories to add... But should.;) # Copyright Zucca. Licence: public domain. if [ -z "$1" ] then echo "Nothing to do. --help for help." >&2 exit 1 fi case $1 in --help) echo -e "USAGE: `basename $0` [-bz] <imgfile> <contents for ISO image>\n -bz makes image compressed." echo "If \"imgfile\" is -, then output will be directed to stdout." ;; *) if [ -z "$2" ] then echo "Missing arguments." >&2 exit 1 elif which mkisofs &> /dev/null then MKISOFSOPTS="-JR -file-mode 0444 -dir-mode 0555" case $1 in -bz) # Zipping BZIPCOMMAND="bzip2 -vzc9" if [ -z "$3" ] then echo "Missing arguments." >&2 exit 1 elif ! which bzip2 &> /dev/null then echo "bzip2 isn't in your \$PATH or isn't installed. Do not use -bz option" >&2 exit 1 elif [ "$2" != "-" ] then DESTFILE="$2" shift shift # To file mkisofs $MKISOFSOPTS $@ | $BZIPCOMMAND > $DESTFILE else # To stdout shift shift mkisofs $MKISOFSOPTS $@ | $BZIPCOMMAND fi ;; *) # No zipping DESTFILE="$1" shift case $DESTFILE in -) # To stdout mkisofs $MKISOFSOPTS $@ ;; *) # To file mkisofs $MKISOFSOPTS -o $DESTFILE $@ ;; esac ;; esac else echo "mkisofs isn't in your \$PATH or isn't installed." >&2 exit 1 fi esac |
Quote |
Spelled out simply: 21 minutes == 94,500 sectors == 184.6MB CD-ROM == 212.0MB CD-DA 63 minutes == 283,500 sectors == 553.7MB CD-ROM == 635.9MB CD-DA 74 minutes == 333,000 sectors == 650.3MB CD-ROM == 746.9MB CD-DA 80 minutes == 360,000 sectors == 703.1MB CD-ROM == 807.4MB CD-DA 90 minutes == 405,000 sectors == 791.0MB CD-ROM == 908.4MB CD-DA 99 minutes == 445,500 sectors == 870.1MB CD-ROM == 999.3MB CD-DA |
Quote (^thehatsrule^ @ Mar. 06 2008,11:40) |
What about DVDs then? You can also use single quotes so that you don't have to escape certain characters on your output strings. Any reason for making this a bash-specific script? |