Shell script datetime function?
Question
I am running the following script:
#!/bin/ksh
./clear_old
./rooms_xls.pl 2/23/09
cd doors
./doors_xls.pl 2/23/09
How can I get the date to be today's date based upon the system/server time?
Solution 2
$(date)
works
OTHER TIPS
This should work fine (and be almost compliant with your format):
#!/bin/ksh
./clear_old
./rooms_xls.pl `date +%D`
cd doors
./doors_xls.pl `date +%D`
Use backticks with the date command:
./rooms_xls.pl `date +%m/%d/%Y`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow