I have a script that when I run from a file manager (Filza), it return an error saying
command substitution: syntax error near unexpected token `('.
line 56: `paste -d'\n' <(echo "$var1") <(echo "$var2"))'
But when I run it from a terminal (./myscript.sh), it ran with no error. Here's the code that gave the error:
#!/bin/bash
var1="A
B
C"
var2="1
2
3"
globalvar=0
while read v1 && read v2; do
globalvar=$(echo $v1 $v2)
done<<<$(paste -d'\n' <(echo "$var1") <(echo "$var2"))
As commented below, it's probably some shell doesn't allow process substitution, thus why it failed. This command is running on iOS environment (jailbroken). Is there alternative way to implement this? Thanks in advance!
bash script.sh, but your shebang points to/bin/sh, the invocation from the file browser will use a different shell. You should also provide a complete script that you can reproduce the issue with, not just a snippet that you suspect.