Sponsored Content
Top Forums Shell Programming and Scripting How to detect whethere the CD is R or RW Post 302218119 by BMDan on Thursday 24th of July 2008 12:03:33 PM
Old 07-24-2008
Something like:

Code:
#Add any needed device specifications to the line below; by default, it'll use /dev/cdrom.
cdrecord -atip | grep -F 'Is erasable'
if [ $? -eq 0 ]; then
    #cdrecord blank option goes here
else
    #cdrecord CD-R option goes here
fi

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to detect process

Dear Sir, Now I use oracle database on AIX server and found some user use iligal program such as development tool logon to my database. I want to detect the process of illegal program and kill it. Could you please suggest me to make detect process. Thank you very much Pkanonwe. (2 Replies)
Discussion started by: pkanonwe
2 Replies

2. Shell Programming and Scripting

xterm detect

i have this script that launches multiple xterm sessionon a CDE. i would like to test the xterm so that when i execute the script using an ordinary terminal it will detect that it will unable to launch the xterm and execute other script instead. i tried using trap and exit status. maybe i am... (2 Replies)
Discussion started by: inquirer
2 Replies

3. UNIX for Advanced & Expert Users

How to detect OS is SLES 10 or not

Hi, I would like to programmatically find if given OS is SLES 10 / RHEL 3/.RHEL 4/RHEL5 etc .. For this do we have any library call/sys call? Or should we use any sys. structure which would give me detailed info. Share me if you have any pointers. Thanks in advance - Krishna (1 Reply)
Discussion started by: krishnamurthig
1 Replies

4. Shell Programming and Scripting

Detect changes in a file

Hi all Just curious , is it possible to detect changes in a file and sent to email . For ex: demo.conf I would like to receive an email everytime a particular file(demo.conf) changes and the content added/removed and who did the change (userid). Is it possible. Thanks CK (4 Replies)
Discussion started by: coolkid
4 Replies

5. Shell Programming and Scripting

detect F5 is pressed

Hello friends, I want to write a shell script in bash shell . Working for the script is to detect any key pressed and disply on screen as "you have pressed: " For example if user pressed F5 then a messaged has to be displayed as "you have pressed F5. Thank you. (4 Replies)
Discussion started by: pradeepreddy
4 Replies

6. Programming

can-not detect TCP disconnects well

Hello everyone. Thanks for reading. I am using Ubuntu 7.04 to experience this problem: I have written my own programs that communicate to eachother and I am having a hard time detecting a TCP socket disconnect when the remote side's computer has a power-failure (for example). On the computer... (6 Replies)
Discussion started by: pjwhite
6 Replies

7. Red Hat

Detect the lun

Hi, Is there command to detect the newly added LUN is linux box. I tried with below commands, but that doesn't work out. fdisk -l, fdisk -l | grep Disk pvscan (5 Replies)
Discussion started by: gsiva
5 Replies

8. Shell Programming and Scripting

Detect changes to crontab

Dear All, My server is running crontabs of 4 different users. I want to develop a script that whenever a particular change occurs in a crontab , it is detected and the particular change is noted into a file. Kindly let me know of suggestions on how it can be achieved. My algo would be: ... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

9. Shell Programming and Scripting

Detect OS

whats the equivalent of detect OS in perl with an if then ? platform='uname' if ]; then alias ls='ls --color=auto' elif ]; then alias ls='ls -G' fi In perl I see perl -Mstrict -MEnglish -E 'say $OSNAME' or print "$^O" Please use CODE tags as required by... (1 Reply)
Discussion started by: nixguynj
1 Replies
MP3BURN(1)						User Contributed Perl Documentation						MP3BURN(1)

NAME
mp3burn - burn audio CDs from MP3, Ogg Vorbis, or FLAC files SYNOPSIS
mp3burn [OPTION] [mp3,ogg, and flac files] DESCRIPTION
mp3burn is a simple command line tool for making audio CDs from MP3s without filling up your disk with .wav files. It uses Perl(1), ogg123(1), mpg321(1) or mpg123(1), cdrecord(1), flac(1), and the MP3::Info(3) Perl module. OPTIONS
-h, --help Prints out a brief help -m, --swap Manual "cdrecord -swab" option mode. Use this to disable the automatic detection for swab mode in case it is not working correctly on your system. (Also, please send email to <formorer@formorer.de> or file a bug against the mp3burn package if you encounter this problem.) -p, --playlist ".m3u playlist" Use a playlist to specify audio files to burn. Instead of (or in addition to) listing mp3/ogg/flac files, supply a .m3u playlist (e.g., from xmms) that contains the audio files for your CD. Note: If you specify both a playlist and audio files, the files specified on the command-line will be appended to the list of audio files listed in the playlist. If a file referenced in a playlist cannot be read, it will be skipped. Be wary of playlist editors that use relative paths - mp3burn cannot know what path the playlist editor assumed. -t, --tmpdir "tmpdir" Put temporary files in tmpdir. Default is to use the current directory. -c, --check "MMM:SS" | ATIP Time check: compute the total length of files to be burned and warn if greater than MMM:SS minutes and seconds. If the value ATIP is supplied, the total length is checked against the length available on the CDR[W] as reported by ATIP. Note that FLAC-encoded files are assumed to be 1 second long (until there is an easy way to get the file duration). You will need to calculate burn-length on your own with FLAC files. -d, --dummy Perform a "dummy" run: do everything except actually burn the CD (uses cdrecord(1) "-dummy" option). -o, --cdrecord "cdrecord_opts" Specify the command line options for cdrecord. The quotes are required to prevent mp3burn from parsing cdrecord(1) options. Overrides options specified in ~/.mp3burnrc. Example: -o "-v dev=1,0 speed=4 -swab" Note: The options -pad and -audio are added automatically, since they are always necessary. The script also tries to detect if -swab is needed (for example on x86 and other little-Endian platforms). cdrecord is supposed to take care of any byte-ordering requirements specific to your burner. (If you end up with a CD that merely sounds like static, you most likely need to toggle use of -swab.) You should also consider using -v so that you can watch the burn in progress. This goes for ~/.mp3burnrc also. -a, --atip Lookup the ATIP info for the device in the cdburner (using cdrecord(1) "-atip") and then exits. This option can only be used (successfully) in conjuction with -o. -M, --encoder "MP3 decoder" Use an MP3 decoder other than the default, which is mpg321. This is imperative when burning tracks that have sample rates other than 44.1kHz, and the current version of mpg321 will not decode these files. Specify the name of the decoder to be used, e.g. mpg123-oss-3dnow; you can also specify this in your .mp3burnrc file with $mp3decoder = mp3decoder. (Note: Currently, the MP3 decoder must be able to accept mpg123-style command-line arguments.) RETURN VALUE
mp3burn returns 0 on success. DIAGNOSTICS
Error in .mp3burnrc: Perl(1) cannot parse the .mp3burnrc file. The following example occurs when a double quote is not terminated: bash-2.05$ sudo mp3burn -d ~/bell.ogg String found where operator expected at (eval 10) line 7, at end of line (Missing operator before ?) Error in .mp3burnrc: Can't find string terminator '"' anywhere before EOF at (eval 10) line 7. bash-2.05$ You will experience this error if you define both $cdrecord_opts and $mp3decoder without terminating the variable assignments with the ';' character: $ mp3burn -d -t /tmp Theodor_Storm_Aquis_submersus_1.mp3 Scalar found where operator expected at (eval 10) line 2, near ""-v speed=2 dev=0,3,0" $mp3decoder" (Missing operator before $mp3decoder?) Error in .mp3burnrc: syntax error at (eval 10) line 2, near ""-v speed=2 dev=0,3,0" $mp3decoder" EXAMPLES
Write an Ogg Vorbis file from a CD-R drive, /dev/scd0, mounted at /mnt/scd0/ to a CD-RW drive, /dev/scd1, called "0,1,0" in cdrecord(1) SCSI notation. Ensure that file is no longer than 50 minutes. sudo(1) is used to get root permissions for cdrecord(1). % sudo mp3burn -c 050:00 -o "-v speed=2 dev=0,1,0" /mnt/scd0/bell.ogg Create a ~/.mp3burnrc that prints a message before writing and uses a different MP3 decoder than the default of mpg321. # This is an example. $cdrecord_opts="-v speed=2 dev=0,1,0"; $mp3decoder = "mpg123-oss-3dnow"; print "Nine seconds to slap a CD-R in the drive! " ; # # See mp3burn(3). # Specify an mp3decoder other than mpg321. $ sudo mp3burn -M mpg123-esd ./rush/*mp3 FILES
~/.mp3burnrc In this file, you may permanently specify the cdrecord options and MP3 decoder you want to use. The format is: $cdrecord_opts = "cdrecord options"; $mp3decoder = "some mp3 decoder"; You may place comments in this file by beginning a line with "#". Note: The values of $cdrecord_opts and $mp3decoder in ~/.mp3burnrc are ignored if the "-o" or "-<"command-line options are used, respectively. CAVEATS
Has not been tested extensively with Ogg Vorbis files. Ogg Vorbis files must be in CD-DA format: i.e. 44100 samples/channel x 16 bits/sample x 2 channels. BUGS
If you execute mp3burn with root permissions, the ~/.mp3burnrc will also be executed with root permissions. NOTES
There are a number of GUI frontends for mp3burn: Xmp3Burn http://perso.wanadoo.es/ja_recio/xmp3burn/xmp3burn.html Kmp3burn http://computer.freepage.de/kmp3burn/index.htm GtkMp3Burn http://gtkmp3burn.sourceforge.net/ SEE ALSO
cdrecord(1), mpg321(1), ogg123(1), ogginfo(1), flac(1), MP3::Info(3) The mp3burn web page is http://mp3burn.sourceforge.net/. The Ogg Vorbis web page is http://www.xiph.org/ogg/vorbis/. The FLAC web page is http://flac.sourceforge.net/. AUTHOR
Copyright (c) 2000 Ryan Richter. Copyright (c) 2003 Alexander Wirt This script was written by Ryan Richter <bobort@bigfoot.com> with much code contributed by Dan Lark <dlark@spinn.net>. I would like to thank Dan Lark <dlark@spinn.net> for contributing the ideas and code for most of the new features, and Tony Mancill <tony@mancill.com> for making Debian packages and helping with debugging. Later in 2003 Alexander Wirt continued to write this program. This program is licensed under the GNU General Public License. You may fold, spindle, and mutilate this software under the terms of the GPL. HISTORY
20031014 <formorer@formorer.de> Switches from standard getopt to GetOpts::Long Updated Manpage for the new option format 20031012 <formorer@formorer.de> Updated mp3burn to use pod2usage Added -h switch for getting help Fixed a bug with the output of file in conduction with FLAC files Added a gracefully exit if there are no valid files left Use String::Shellquote to avoid problems with the shell 20030203 <tmancill@debian.org> hacked in support for FLAC, as per suggested by <ldm@apartia.org> 20021110 <tmancill@debian.org> updated to work with new ogginfo output format in vorbis-tools 1.0; modified slightly to not create FIFOs for invalid MP3/OGG files 20020728 <tmancill@debian.org> added -M $mp3decoder switch to support MP3 decoders other than mpg321 and mpg123-oss 20010917 <tmancill@debian.org> added check to automatically add -swab on ia32 platform MP3::Info(3) replaces MPEG::MP3Info mp3burn 0.02 10/28/00 Changes since 0.01: Bugfixes: Spaces, quotes, and other shell metacharacters in filenames should no longer problematic, since we use Shell:QuoteString to avoid problems with that (Feedback for that is wished). Mono MP3s and MP3s not sampled at 44.1kHz are no longer problematic. New Features: Editing the executable is no longer necessary; cdrecord options can be specified on the command line or in ~/.mp3burnrc. Temp dir for FIFOs may be set to other than the current dir. Dummy runs now supported from the command line. A time check is now available: mp3burn can abort if total time exceeds a threshold. Requires MPEG::MP3Info. Playlist support. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 583: You forgot a '=back' before '=head1' Around line 589: '=item' outside of any '=over' perl v5.14.2 2012-04-09 MP3BURN(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy