LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2005, 10:47 AM   #1
landroni
Member
 
Registered: Feb 2005
Distribution: Xubuntu 12.04 LTS
Posts: 154

Rep: Reputation: 16
error in script for copying scratched cds


I have a scratched data CD containing one .avi file. Using normal copying methods on Linux and Windows ended up with errors. I found a hopefully helpful script on http://mail.plug.linux.org.au/piperm...t/056306.html.

I copied the script to a text file: unscratch and copied it to /usr/local/bin.

Code:
[root@localhost cdrom]# chmod +x /usr/local/bin/uscratch
[root@localhost cdrom]# vim /usr/local/bin/uscratch
#!/bin/sh
BYTES==`fdisk -l /dev/hdc | grep Disk | cut -f2 -d"," | cut -f2 -d" "`
BLOCKS=`dc -e "$BYTES 512 / p"`
echo $BLOCKS
COUNT=10000
POS=0
while [ "$POS" -le "$BLOCKS" ] ; do
         let RETRY=1
         let RCOUNT=0
         while [ ! "$RETRY" -eq "0" ] ; do
         COPIED=`dd if=/dev/hdc of=/mnt/sdab/etc/tmp/test.iso seek=$POS skip=$POS count=$COUNT 2>&1 | grep "records out" | cut -f1 -d"+"`
         echo -n Copied $COPIED blocks from $POS " "
         let POS+=$COPIED
         if [ "$COPIED" -ne "$COUNT" ] ; then
                 echo
                 echo Copied not equal to count!
                 if [ "$POS" -ne "$BLOCKS" ] ; then
                         echo And were not at end of disc
                         let RETRY=1
                 else echo Yahoo!!! End of disk!
                      exit 1
                 fi;
                 else let RETRY=0
         fi;
         if [ "$COPIED" -eq "0" ] ; then
                 let POS-=10
                 fi;
         echo with Result $RETRY and $RCOUNT retries
         let RCOUNT++
         if [ "$RCOUNT" -ge "50" ] ; then
                 echo Ctrl-S here to clean disk
                 eject /dev/hdc
                 sleep 1
                 eject -t /dev/hdc
                 sleep 1
                 let RCOUNT=0
                 fi;
         done;
done;
[root@localhost bin]# uscratch
Disk /dev/hdc doesn't contain a valid partition table
/usr/local/bin/uscratch: line 1: dc: command not found

/usr/local/bin/uscratch: line 7: [: : integer expression expected
I do not know how to correct these errors as i am a complete newbie to scripts. The CD was well mounted when i ran the script.
 
Old 11-05-2005, 04:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
the first error about the lack of partition table isn't an error. and as for the other, clearly you don't have dc installed.
 
Old 11-07-2005, 12:58 PM   #3
landroni
Member
 
Registered: Feb 2005
Distribution: Xubuntu 12.04 LTS
Posts: 154

Original Poster
Rep: Reputation: 16
And how should i install dc? Searched on google, but did not find no source package to compile or anything.

===

Dc comes in with bc.

Last edited by landroni; 11-23-2005 at 09:53 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copying audio cds skoot Linux - Newbie 8 05-18-2005 08:56 AM
Copying files from scratched CD Fade_t Linux - Software 1 05-01-2005 01:57 AM
Good ripper for scratched CDs? BaltikaTroika Linux - Software 1 11-01-2004 08:42 AM
copying cds lxandrthegr8 Linux - Hardware 0 08-13-2003 04:27 PM
Problem copying audio CDs Wynd Linux - General 2 05-05-2003 08:33 PM


All times are GMT -5. The time now is 08:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration