Unix Shell - Re: How to display from shell script the "last modified date" of the current

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > December 2007 > Re: How to display from shell script the "last modified date" of the current





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: How to display from shell script the "last modified date" of the current
Chris Davies

2007-12-10, 1:20 pm

Karl Medrell <k.medrell@hotmail.com> wrote:
> Assume I want to display the "last modified (date+) time of the script
> which is currently running. How can I access this date/time information
> from within the same script and display it?


In the general case you can't reliably do that; someone might have
deleted and/or replaced the script shortly after you started running
it. Or it might not be a file-based script at all, in which case there
is no file to check. Or it might reside on a filesystem that doesn't
provide last-modified information.

If you're talking about a specific script, then presumably you know what
it's called and where it is, so you can just use "ls -l".

(There are things you can do with $0 and PATH, but they're not guaranteed
to work in all cases. See above.)

Chris
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com