LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-08-2005, 11:45 PM   #1
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Rep: Reputation: 30
help creating a script...


Hey all,

I want to be able and create a bash script that will output the name of the volume in my cd drive, display all the files and the date it was created...

Is this possible?
 
Old 01-08-2005, 11:53 PM   #2
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
As for the name, I've no idea. But for the files:
Code:
ls -aRl
 
Old 01-09-2005, 12:19 AM   #3
evilmrhenry
Member
 
Registered: Oct 2003
Distribution: Knoppix
Posts: 103

Rep: Reputation: 15
The command volname returns the name of a CD.

ls -lt should help you with the date. It shows the modified date for each file. Depending on your burning software, this could be the creation date of the CD. If not, try the -ult option, which gives the time of last access.
 
Old 01-09-2005, 12:58 AM   #4
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Thanks evilmrhenry - thats the command I was looking for. So, your script would look like this:

Code:
#!/bin/bash

# cdinfo - output the name of the volume in my cd drive, display all the files and the date it was
# created

# Usage: type "cdinfo" while in the directory of the mounted CD

echo "Volume name: "
volname
echo "Files: "
ls -aRl

#EOF
Put that into a text file, and put the text file in /usr/bin
Then, do this (as root):
Code:
chmod 755 /usr/bin/cdinfo
Then, mount a CD, cd to the direcory, and issue this command:
Code:
cdinfo
Enjoy

Last edited by scuzzman; 01-09-2005 at 12:59 AM.
 
Old 01-09-2005, 01:22 AM   #5
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
awesome thanks

is there a website with the basic scripting so i can make my own in the future?
 
Old 01-09-2005, 01:27 AM   #6
evilmrhenry
Member
 
Registered: Oct 2003
Distribution: Knoppix
Posts: 103

Rep: Reputation: 15
Quote:
is there a website with the basic scripting so i can make my own in the future?
Lots of them. A quick search turned up this:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

The keyphrase you want is "bash scripting"
 
  


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
Creating a configure script hylke Programming 4 04-21-2005 02:47 PM
Creating a script thomas289 Linux - Networking 1 12-17-2004 12:59 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 11:23 PM
Creating a Script? BajaNick Linux - Software 1 07-26-2003 08:55 PM
Creating users with a script 80s Linux - General 3 01-13-2003 01:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:39 PM.

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