LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 02-04-2004, 01:41 PM   #1
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Rep: Reputation: 15
Linux Shell Scripting using BASH Help!


Hi, Im working on a school assignment and i have gotton almost the rest of the script working but have gotton stuck, I have to right a script that output this

Last Access Time: 2004-01-14 10:24
Creation/Modified Time: 2004-01-13 15:02

Im not sure how i find the specfic access time of a file in that format any help would be greatly appeciated

Jamie
 
Old 02-04-2004, 01:51 PM   #2
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Check out the 'ls' manpage - it has options for formatting the time, like "--time-style", and an option "--time=xxx" for showing creation time, access time, etc.
 
Old 02-04-2004, 02:08 PM   #3
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Original Poster
Rep: Reputation: 15
I have looked up the ls man pages and found those entries, but I tried

jsmacmil@matrix:~> ls --time=access

ls Labtree otherclasses l2.text
cat bak public_html partner.stu
asgm1 drivers Cisco PIX Firewall Features.doc rollem.bash
Desktop lab1 expressions.bash spam.stu

this is my output it doesn't list any times at all it only sorts by time so if there is a switch or something im missing please gu9ide me in the right diretion
 
Old 02-04-2004, 02:11 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Take a look at stat:
man stat
 
Old 02-04-2004, 02:58 PM   #5
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
With ls, you need to use the -l option to see dates and stuff. 'stat' is probably better suited to your purposes anyway.
 
Old 02-05-2004, 09:16 AM   #6
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Original Poster
Rep: Reputation: 15
Thank you for u help stat command worked prefectly
Thank you

Jamie
 
  


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
Bash shell scripting Sco Linux - Newbie 1 11-09-2004 11:58 AM
Help with I/O on bash shell scripting Dave6383 Programming 1 06-03-2004 05:24 PM
some bash shell scripting eltongeoff Linux - Newbie 2 10-22-2003 01:10 PM
Bash Shell Scripting Help Tangerine Programming 6 05-06-2003 02:10 PM
BASH Shell scripting help ewarmour Linux - General 8 05-25-2002 07:10 AM


All times are GMT -5. The time now is 04:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration