Bug 1381531
Summary: | generated for loop snippet beside pcs commands gives syntax error if executed from file | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Miroslav Lisik <mlisik> | |
Component: | clufter | Assignee: | Jan Pokorný [poki] <jpokorny> | |
Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.3 | CC: | mlisik | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | clufter-0.75.0-1.el7 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1381572 (view as bug list) | Environment: | ||
Last Closed: | 2017-08-01 23:06:21 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | 1387424 | |||
Bug Blocks: |
Description
Miroslav Lisik
2016-10-04 11:44:05 UTC
Correct 3rd step should be: [root@virt-024 ~]# sh snippet.sh snippet.sh: command substitution: line 6: syntax error near unexpected token `(' snippet.sh: command substitution: line 6: ` comm -12 <( python -m json.tool /var/lib/pcsd/pcs_users.conf | sed -n 's|^\s*"[^"]\+":\s*"\([0-9a-f-]\+\)".*|\1|1p' | sort ) <( python -m json.tool /var/lib/pcsd/tokens | sed -n 's|^\s*"[^"]\+":\s*"\([0-9a-f-]\+\)".*|\1|1p' | sort ) )' Miro, the error you observe comes from the fact that you are trying to run bash-extended shell syntax (process substitution in particular) with /bin/sh, i.e., a POSIX mode of the shell. That means that you should have used /bin/bash instead in [comment 0]. I do not mean to make do without that construct (the equivalent would be a bigger, less readable code), but instead, I decided to put explicit shebangs at the beginning of any shell-like output so as to make the intended interpreter clear: https://pagure.io/clufter/c/00927b704c78023096e1004a31869085f659def7?branch=next https://pagure.io/clufter/c/8c1bb903faa198246c15a261af4fe6dd5f8d5df1?branch=next https://pagure.io/clufter/c/4667896ce5b3ffb839e69403819d3d9331d079d8?branch=next Do you consider this solution sufficient? Yes, I consider this solution sufficient. Shebangs inform users what kind of shell to use. Already fixed in upstream, since v0.59.7. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:2198 |