title: How to run bash script file in Airflow
body: <p>I have a bash script that creates a file (if it does not exist) that I want to run in Airflow, but when I try it fails. How do I do this?</p>
  
  <pre><code>#!/bin/bash
  #create_file.sh
  
  file=filename.txt
  
  if [ ! -e "$file" ] ; then
      touch "$file"
  fi
  
  if [ ! -w "$file" ] ; then
      echo cannot write to $file
      exit 1
  fi
  </code></pre>
  
  <p>and here's how I'm calling it in Airflow:</p>
  
  <pre><code>create_command = """
   ./scripts/create_file.sh
  """
  t1 = BashOperator(
          task_id= 'create_file',
          bash_command=create_command,
          dag=dag
  )
  
  lib/python2.7/site-packages/airflow/operators/bash_operator.py", line 83, in execute
      raise AirflowException("Bash command failed")
  airflow.exceptions.AirflowException: Bash command failed
  </code></pre>