0

i'm trying to run following command from cron:

[[ -d some_folder_path ]] && [[ $(date +%u) -lt 6 ]] && touch ~/testOK

Unfortunately it's not working although when I run it outside the cron it works perfectly.

Kind request for help solving the issue.

qaz82
  • 3
  • 2

1 Answers1

0

First thing you have to make sure that your SHELL variable is set to Bash. crontab has special meaning for % so you have to escape it using "\"

so I tested your cronjob it should be like

* * * * * [[ -d /Users/mkhade/Downloads ]] && [[ $(date +\%u) -lt 6 ]] && touch ~/testOK
mGeek
  • 786
  • 8
  • 11