xuhdev/SingleCompile

Problem with bash scripts

Closed this issue · 2 comments

The following script runs OK directly from the shell:

#!/bin/bash

echo $$
ps ax | grep sh

source_dir=(/data/abc \
            /data/cde \
            /net/fgh)


for i in ${source_dir[*]}; do
    echo "Entering directory $i/.."
done

But it fails with :SCCompileRun:

temp.sh: 10: /home/mmontu/temp.sh: Syntax error: "(" unexpected

From the output before the error message it can be seen that it is being run with the following line:

13361 pts/16   S+     0:00 /bin/bash -c (sh  /home/mmontu/temp.sh; echo $? >/tmp/vESldod/386) 2>&1| tee /tmp/vESldod/387

Thus the problem is that despite the shebang indicates bash, the script is being run by sh. But it is unclear why this plugin needs to run the script in a separate shell.

It should now be fixed. Please report back if you have further questions.

It works like a charm. Thanks!!