Answer the question
In order to leave comments, you need to log in
Variable assignment not working in cron?
OC - ubuntu
has a script of banal content - creates files in the name of which the date of creation is present
-----------------------
#!/bin/ bash
date=`date '+%d%m%y_%H.%M.%S'`
*/1 * * * * echo "123" > /vagrant/crontab/$date.txt
------ -----------------------
script creates file: `date '+%d%m%y_%H.%M.%S'`.txt
though if you run the following commands in the console:
$ date=`date '+%d%m%y_%H.%M.%S'`
$ echo "123" > /vagrant/crontab/$date.txt
then the expected date file is created in the name.
what could be the snag?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question