Quantcast
Channel: Bash: Retrieving and comparing two dates - Server Fault
Browsing latest articles
Browse All 4 View Live

Answer by serverhorror for Bash: Retrieving and comparing two dates

I'd simply compare on number of seconds since the epoch ls -lt --time-style="+%s". That gives you a nice number you can compare on. From man bash arg1 OP arg2 OP is one of -eq, -ne, -lt, -le, -gt, or...

View Article



Answer by HUB for Bash: Retrieving and comparing two dates

/bin/date can convert time to formats, including seconds from epoch. DATE_1="`svn info svn://server.com/reponame -r 'HEAD' | grep 'Last Changed Date' | grep -E -o \"[0-9]{4}-[0-9]{2}-[0-9]{2}\...

View Article

Answer by Philip Reynolds for Bash: Retrieving and comparing two dates

## Specify the filename to dump here _filename = svn.dump ## Grab the mtime of the file and print out in "seconds since Epoch format" _fileepoch=$(find ${_filename} -printf "%Ts") ## Grab the last...

View Article

Bash: Retrieving and comparing two dates

In Bash script, I would like to compare two dates and if one is greater than the other, carry out a task. Two dates that I'm comparing are: svn repo's last change date, I get the date info like so:...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images