Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 752 Bytes

SC1142.md

File metadata and controls

35 lines (24 loc) · 752 Bytes

Pattern: Missing use of done < <(cmd)

Issue: -

Description

ShellCheck found a done keyword followed by a process substitution, e.g. done <(cmd).

The intention was most likely to redirect from this process substitution, in which case you will need one extra <: done < <(cmd).

This is because <(cmd) expands to a filename (e.g. /dev/fd/63), and you need a < to redirect from filenames.

Example of incorrect code:

sum=0
while IFS="" read -r n
do
  (( sum += n ))
done <(file) 

Example of correct code:

sum=0
while IFS="" read -r n
do
  (( sum += n ))
done < <(file) 

Further Reading