<p>I am using <a href="https://airflow.apache.org/docs/helm-chart/stable/index.html" rel="nofollow noreferrer">the Helm chart for Apache Airflow</a> and creating a user using the <code>createUserJob</code> section:</p>
<pre class="lang-yaml prettyprint-override"><code>airflow:
  createUserJob:
    command: ~
    args:
      - &quot;bash&quot;
      - &quot;-c&quot;
      - |-
        exec \
        airflow {{ semverCompare &quot;&gt;=2.0.0&quot; .Values.airflowVersion | ternary &quot;users create&quot; &quot;create_user&quot; }} &quot;$@&quot;
      - --
      - &quot;-r&quot;
      - &quot;{{ .Values.webserver.defaultUser.role }}&quot;
      - &quot;-u&quot;
      - &quot;{{ .Values.webserver.defaultUser.username }}&quot;
      - &quot;-e&quot;
      - &quot;{{ .Values.webserver.defaultUser.email }}&quot;
      - &quot;-f&quot;
      - &quot;{{ .Values.webserver.defaultUser.firstName }}&quot;
      - &quot;-l&quot;
      - &quot;{{ .Values.webserver.defaultUser.lastName }}&quot;
      - &quot;-p&quot;
      - &quot;{{ .Values.webserver.defaultUser.password }}&quot;
</code></pre>
<p>However, if it exists, I would like to delete the user before creating it, but the following does not work:</p>
<pre class="lang-yaml prettyprint-override"><code>airflow:
  createUserJob:
    command: ~
    args:
      - &quot;bash&quot;
      - &quot;-c&quot;
      - |-
        exec \
        airflow users delete --username admin ;
        airflow {{ semverCompare &quot;&gt;=2.0.0&quot; .Values.airflowVersion | ternary &quot;users create&quot; &quot;create_user&quot; }} &quot;$@&quot;
      - --
      - &quot;-r&quot;
      - &quot;{{ .Values.webserver.defaultUser.role }}&quot;
      - &quot;-u&quot;
      - &quot;{{ .Values.webserver.defaultUser.username }}&quot;
      - &quot;-e&quot;
      - &quot;{{ .Values.webserver.defaultUser.email }}&quot;
      - &quot;-f&quot;
      - &quot;{{ .Values.webserver.defaultUser.firstName }}&quot;
      - &quot;-l&quot;
      - &quot;{{ .Values.webserver.defaultUser.lastName }}&quot;
      - &quot;-p&quot;
      - &quot;{{ .Values.webserver.defaultUser.password }}&quot;
</code></pre>
<p>Is there a way to run more than one command here?</p>

wjmolina
<p>Remove the word <code>exec</code>.</p>
<p>The syntax you show here runs <code>bash -c 'command' args</code> as the main container command, where <code>args</code> is a list of arguments that are expanded inside the command as <code>$0</code>, <code>$1</code>, <code>$2</code>, and so on.  Inside the command string <code>&quot;$@&quot;</code> expands to those positional parameters starting at <code>$1</code>.  This is set up correctly.</p>
<p>Inside the command string, <code>exec</code> is a <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_20" rel="nofollow noreferrer">special built-in utility</a>: <code>exec some_command</code> replaces the current shell with <code>some_command</code>, and in effect ends the current script.  In a container context this is useful for controlling which process is the main container process, but in this short-lived script it's not especially necessary.  In particular if you're going to <code>exec</code> a command it must be the <em>last</em> command.</p>
<p>I might structure this as:</p>
<pre class="lang-yaml prettyprint-override"><code>command:
  - /bin/sh
  - -c
  - |-
    airflow users delete --username &quot;{{ .Values.webserver.defaultUser.username }}&quot;;
    airflow users create &quot;$@&quot;
  # (no `exec` in this command string)
  - --
args:
  - &quot;-r&quot;
  - &quot;{{ .Values.webserver.defaultUser.role }}&quot;
  - &quot;-et&quot;
  - cetera
</code></pre>
<p>Here the <code>command:</code>/<code>args:</code> split is kind of artificial but it makes it slightly clearer how the command words are split up.</p>
