I have the following code in a databricks notebook:
%sh
export current_date=$(date '+%Y-%m-%d')
echo $current_date
> 2021-09-29
That works fine and for the current cell I can access and use the variable $current_date
, however, if I try to call this variable in another cell I get empty as a result:
%sh
echo $current_date
>
This notebook might take more than one day to run, thus I want to define the current date when it starts running and use this value afterwards as a variable. How can I do that?