![mac os x shell script date mac os x shell script date](https://www.lifewire.com/thmb/dyx3ewuS-FOLvGicOqX2mhuwJbY=/966x966/smart/filters:no_upscale()/how-to-save-terminal-commands-on-a-mac-51877871-904e2096e704422ab3fd353574322dc9.jpg)
![mac os x shell script date mac os x shell script date](https://www.cyberciti.biz/media/new/faq/2009/01/Unix-Date-Command-Examples.png)
![mac os x shell script date mac os x shell script date](https://i.stack.imgur.com/5HKN8.png)
I got as far as confirming that this was not a case of simply not having enough memory to do the job, rather there appeared to be a memory leak in a library that I used to process the GA data.Īnyway, that memory leak issue is a problem that still needs to be solved, but I did not have the necessary time when I needed this to work and that is not the topic here anyway. You can also use -o or -or for the OR operator, and you can use parentheses which must be quoted to protect them from the shell, as in \(and \) for grouping. I was not able to resolve the memory leak issue caused by parsing very large XML documents so I settled on writing a shell script that would process the data one day at a time by essentially calling the PHP script over and over instead of having it process all data during a single run. If I choose a date range that was too large, PHP would run out of memory. CURDATE (date +'dmY') BACKUPFILE'/folder/backup/backupdbCURDATE' find /folder/backup -name '.backup' -type f -Btime +4d -delete /Applications/pgAdmin3.app/Contents/SharedSupport/pgdump -h localhost -p 5432 -U postgres -F c -b -v -f 'BACKUPFILE' db.
#Mac os x shell script date how to#
The date function on OS X (Snow Leopard) does not have the -date option like the GNU version and I am not able to figure out how to get the equivalent of the following on OS X. Ask Question Asked 11 years, 2 months ago. Simply type the following command at the shell prompt to get the current date in MM-DD-YYYY format: NOW (date +'m-d-Y') To display a variable use the following simple commands to output on screen under Linux and UNIX using the printf command / echo command: echo 'NOW'. In the comment by hk0i you will find a simpler way of doing this by installing the coreutils via homebrewĪ little while ago I came across a problem in PHP where I had to process large amounts of data from Google Analytics. Loop from start date to end date in Mac OS X shell script.