0

i need to run a shell script included in an automator app as "run shell script" action wherein i generate a file with this filename:

filename=$(date +%m-%d-%Y-%k-%M)'_test.png'

When i run this line in terminal it works. When i run the automator app manually by clicking "play" it works. But when i add the automator app to launchctl to schedule it, this does not work anymore, what i get is:

09-22-2012-

instead of something like

09-22-2012-20-10_test.png

So where is the difference between running the automator app manually and from launchctl as a launch deamon and how do i have to change the line to make it work in both scenarios? Very weird that the formatting via launchctl works for the date but has a problem with the time values.

thanks a lot!

homtg
  • 1,999
  • 1
  • 15
  • 20

1 Answers1

1

you don't have to have only date/time specifiers in the format string.

I don't have access to automator to test your case, but try

filename=$(date +%m-%d-%Y-%k-%M_test.png)

I'm betting that something about the single-quotes you're using is causing a problem.

IHTH.

shellter
  • 36,525
  • 7
  • 83
  • 90