title: BASH_SOURCE variable is empty when script is sourced from cron
body: <p>I have a script, at the beginning of which I capture the script path and the folder using BASH_SOURCE variable as below</p>
  
  <pre><code>#!/bin/bash
  
  FILE_NAME=$(realpath "$BASH_SOURCE")
  FILE_DIR=$(dirname "$FILE_NAME")
  </code></pre>
  
  <p>This runs fine when executed from the command line, but fails when sourced from the crontab.</p>
  
  <p>Especially the variable BASH_SOURCE is empty when run from the crontab. </p>
  
  <p>I am trying to source the file rather than executing it.</p>
  
  <p>Any idea what is happening here ?</p>
  
  <p>Thanks</p>