shell script error - Bad substitution

106 views
Skip to first unread message

chris snow

unread,
Feb 11, 2014, 3:26:27 PM2/11/14
to packe...@googlegroups.com
I have the following script that throws a Bad substitution error.  I think it's due to this: ${IMPORTS[*]}

The research I've done online suggests to me this sort of error can be cause if the script is run by "sh" instead of "bash"

How does packer execute the script?  The script is run by root (ssh_username), and the script is run on a debian wheezy box.

Are there any workarounds?

----
#!/bin/bash

IMPORTS=$(find /var/log -type f -name *.log.*)

for item in ${IMPORTS[*]};
do
   IMPORT="$(dirname $item)/"

   # perform the import
   echo $IMPORT
done

chris snow

unread,
Feb 11, 2014, 4:42:29 PM2/11/14
to packe...@googlegroups.com
The problem was just due to the way the script was getting run, see here: https://github.com/mitchellh/packer/issues/862
Reply all
Reply to author
Forward
0 new messages