: Using Bash shell script how to test if the file has been modified by checking the time stamp of the file. : : Thanks. :
to get just the timestamp use [code] /bin/ls -l $1 | cut -b44-55 [/code]
to test for changes you can try something like: [code] #!/bin/sh
if test -N $1; then echo "exists and has changed since read" : else if test -a $1; then echo "not changed" : else echo "not existing" fi fi [/code] to test against the last read time. afaik the creation time isn't stored.
Comments
:
: Thanks.
:
to get just the timestamp use
[code]
/bin/ls -l $1 | cut -b44-55
[/code]
to test for changes you can try something like:
[code]
#!/bin/sh
if test -N $1; then
echo "exists and has changed since read"
:
else
if test -a $1; then
echo "not changed"
:
else
echo "not existing"
fi
fi
[/code]
to test against the last read time. afaik the creation time isn't stored.