# perl -e 'print time' will return the current time in Unix epoch format # So if you substract 43200, that should give you the current time minus 30 minutes in Unix epoch format: time=$(perl -e 'print time-43200')