Skip to content

Commit 4b5b41c

Browse files
authoredFeb 25, 2025
Fix "ambiguous redirect" error in check/shellcheck (quantumlib#7078)
* Fix "ambiguous redirect" error in check/shellcheck On my system, running `check/shellcheck` results in an error: ``` check/shellcheck: line 33: 0: ambiguous redirect ``` The reason concerned the use of the shell `<(...)` construct. It seems that with some combination of user Bash options, versions of Bash, and possibly other factors, the output is not compatible with using a `<` redirection; however, I was unable to figure out exactly why. I ultimately resolved it by using a slightly different syntax for the git/pipeline output and variable assignment. * Fix up formatting 1. Get rid of unnecessary backslash, per review comment. 2. Dedent the subsequent pipe commands to make things more clear. 3. Put the closing parens on a separate line, for style consistency.
1 parent 7764413 commit 4b5b41c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎check/shellcheck

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ for arg in "$@"; do
3030
done
3131

3232
# Find all shell scripts in this repository.
33-
IFS=$'\n' read -r -d '' -a our_shell_scripts < \
34-
<(git ls-files -z -- \
33+
IFS=$'\n' read -r -d '' -a our_shell_scripts <<< "$(
34+
git ls-files -z -- \
3535
':(exclude)*.'{py,json,json_inward,repr,repr_inward,ipynb,txt,md} \
3636
':(exclude)*.'{yaml,ts,tst,rst,pyi,cfg} | \
37-
xargs -0 file | grep -i 'shell script' | cut -d: -f1)
37+
xargs -0 file | grep -i 'shell script' | cut -d: -f1 \
38+
)"
3839

3940
# Verify our_shell_scripts array - require it must contain files below.
4041
typeset -a required_shell_scripts

0 commit comments

Comments
 (0)
Please sign in to comment.