I have a sh (shebang
#!/bin/sh) script (
sh.sh) which invokes a bash (shebang
In the bash script I have a declaration of an associative array:
declare -A properties, thus getting the error
declare: not found.
It's obvious why
declare isn't found as the parent script is a sh script and not bash.
Is there a way to force bash syntax?
Another way is to open a new shell, but it's problematic because the subscript's purpose is to define variables to be used in the parent script. Sub-shells shouldn't be messing with parent's variable.
#!/bin/sh . "some-path/bash.sh"
#!/bin/bash declare -A properties
Usage I was trying: