Skip to content
Advertisement

Are there any solutions to this command(shell code) problem

I have some shell codes looks like:

JavaScript

but, get an error “-bash: syntax error near unexpected token `(‘” which i can’t fix it. I do know the pipeline command can also do it well. likes

JavaScript

but actually I wish to do something in the loops like change the global value

JavaScript

and the pipeline didn’t work.

Advertisement

Answer

The correct syntax for process substitution is:

JavaScript

But anyways, doing it this way is not a good idea at all, use a for loop instead:

JavaScript

And if you need to get information about a file in the loop, use stat.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement