Cannot make bash script work from cloud-init

Viewed 7511

Obviously I am doing something wrong here.

Cloud init script /etc/cloud/cloud.cfg

...
runcmd:
 - [ sh, /opt/cloud-init-scripts/whatever.sh ]

The script /opt/cloud-init-scripts/whatever.sh

#!/bin/bash
...
. /home/ubuntu/third-party/script.sh --silent

Third party script /home/ubuntu/third-party/script.sh

#!/usr/bin/env bash

function some_function() {
...

Error I am getting in /var/log/cloud-init-output.log

/opt/cloud-init-scripts/whatever.sh: 3: /home/ubuntu/third-party/script.sh: Syntax error: "(" unexpected

I must be missing something obvious here. I tried using source, . and sh when calling the third party script, tried changing shebangs everywhere but no success.

If I run the same command from command line it works.

1 Answers
Related