It is not yet clear, but the chances are very high that you either have the wrong Shebang line at the top of the script:
#!/bin/sh
either you use sh script.sh instead of bash script.sh during testing, or you have SHELL=/bin/sh or something similar in the environment. Your error is related to the process replacement code. When Bash starts as sh (in POSIX mode ), process substitution is not available:
- Substitution process is not available.
You need to write:
#!/bin/bash temp=$(comm -12 <(sort -u /home/xyz/a.csv1) <(sort -u /home/abc/tempfile) | wc -l) echo $temp
or even just:
which achieves the same effect as a capture followed by an echo. When testing, use bash -x script.sh or bash script.sh .
Deciphering a illegible comment
In a illegible (and now deleted) comment, this information apparently includes:
BASH = / bin / w
BASHOPTS = cmdhist: extquote: force_fignore: hostcomplete: interactive_comments: progcomp: promptvars: SourcePath
BASH_ALIASES = ()
BASH_ARGC = ()
BASH_ARGV = ()
BASH_CMDS = ()
BASH_LINENO = ([0] = "0")
BASH_SOURCE = ([0] = "a.sh")
BASH_VERSINFO = ([0] = "4" [1] = "1" [2] = "2" [3] = "1" [4] = "release" [5] = "x86_64-redhat-linux-gnu ")
BASH_VERSION = '4.1.2 (1) -release
CVS_RSH = SSH
SHELL = / bin / bash
SHELLOPTS = braceexpand: hashall: interactive-comment: POSIX
SHLVL = 2
Note that BASH=/bin/sh and SHELLOPTS=braceexpand:hashall:interactive-comments:posix . Any or both of these can be a major part of the problem.
Jonathan leffler
source share