LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2008, 04:11 AM   #1
freeindy
Member
 
Registered: Nov 2002
Posts: 207

Rep: Reputation: 32
Data cd title in bash


Hi,

A simple question:
How can I retreive the data cd title in bash?

Thanks,
Indy
 
Old 06-27-2008, 05:17 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
volname
This is a little utility coming with the eject package. If you don't specify the device name (as in my example) it defaults to /dev/cdrom. If you don't have the volname utility you can read the label using the dd command:
Code:
dd if=/dev/cdrom bs=1 skip=32808 count=32 2>/dev/null
the redirection of the standard error to /dev/null is meant to strip out the statistics from the output of the dd command.
 
Old 06-27-2008, 05:50 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
* please ignore / delete *
(did not read thread very well, sry)

Last edited by Hko; 06-27-2008 at 05:53 AM.
 
Old 07-01-2008, 10:35 AM   #4
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Rep: Reputation: 30
colucix, are you saying that the cd title information is 32 bytes long located at an offset of 32808 blocks (in 512 chucks) from the start? where did you find this info? i've been googling for a few minutes and can't seem to find anything
 
Old 07-01-2008, 10:35 AM   #5
sk8guitar
Member
 
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

Rep: Reputation: 30
i'm just personally curious
 
Old 07-01-2008, 11:13 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by sk8guitar View Post
colucix, are you saying that the cd title information is 32 bytes long located at an offset of 32808 blocks (in 512 chucks) from the start?
Not really. The offset is 32808 bytes (see bs=1 in the dd command above). The structure of a ISO9660 CDROM is divided in blocks of 2048 bytes. The first sixteen blocks are the System Area and does not conform to any standard. Then follows a Primary Volume Descriptor, whose structure tell us that at bytes from 41 to 72 the volume identifier (that is the CD title) is written. So 2048*16 + 40 = 32808 is the offset to read the volume identifier.

Such informations are contained in the official standard "Volume and file structure of CDROM for Information Interchange". The structure of the Primary Volume Descriptor is specified in paragraph 8.4 at page 17 (see table).

More simply the dd command above is taken from the Linux CDROM Howto. Forgive me, I did not mention!
 
  


Reply



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
Changing the gtkdialog title with bash jimmy512 Programming 2 09-07-2007 11:00 AM
xclock show time in window title bar (using bash?) jaybee Linux - Software 5 06-19-2006 01:27 PM
Bash: set Konsole window title to current command bforbes Programming 5 04-19-2006 11:44 AM
change console title in bash script? TLV Linux - Software 18 10-08-2004 11:25 AM
Bash: Extract Title Information From Playlist xxfunkxx Linux - Newbie 5 07-28-2004 02:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:21 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
Open Source Consulting | Domain Registration