| 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
|