0

What is wrong with this script?

#!/bin/sh

for file in *.p; do awk -f get_p.awk "$file" > "$file"er; done 

awk -f phase-comp.awk file1 file.per # výpočet fází
paste <(awk '{print $1}' output1) <(awk '{print $2}' file1) > out

The error is:

5: skript: Syntax error: "(" unexpected

When I write command separately to terminal. It works well. Thank you

oguz ismail
  • 1
  • 16
  • 47
  • 69
Lukáš Altman
  • 497
  • 1
  • 5
  • 15
  • Other dupes: [Doesn't sh support process substitution <(...)?](https://stackoverflow.com/q/18631499/3266847), [How to use process substitution in a script run with sh instead of bash?](https://stackoverflow.com/q/31371672/3266847), [sh -c and process substitution](https://stackoverflow.com/q/39069179/3266847) – Benjamin W. Apr 27 '19 at 21:22

1 Answers1

4

The problem is your shebang:

#!/bin/sh

It means this script is meant to be interpreted by sh, but your script uses process substitution which is a bash-specific feature. So, you should change it to:

#!/bin/bash

to make your script work.

oguz ismail
  • 1
  • 16
  • 47
  • 69