Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have following bash command

diff <(xzcat file1.xz) <(xzcat file2.xz)

and I need to execute it in dash. On my system (Debian Wheezy), dash is the default interpreter for cron (/bin/sh is a link to /bin/dash).

When I execute the command in dash, I get following error:

Syntax error: "(" unexpected
share|improve this question
mywiki.wooledge.org/Bashism – Alex Oct 2 '13 at 15:08
Debian also has a checkbashisms script. I forget the package name, though. – strugee Oct 2 '13 at 16:45
The package name is devscripts – Martin Vegter Oct 2 '13 at 17:40
up vote 6 down vote accepted

Yes, process substitution is a non-standard feature originated in ksh and only available in ksh, bash and zsh.

On systems that support /dev/fd/n (like Debian), you can do:

xzcat < file1.xz | { xzcat < file2.xz | diff /dev/fd/3 -; } 3<&0

Or you can always do:

bash -c 'diff <(xzcat file1.xz) <(xzcat file2.xz)'
share|improve this answer

If you need a specific shell when running something from a cron job wrap it in a script and call the script from the cron.


diff <(xzcat file1.xz) <(xzcat file2.xz)

Cron entry

*  *  *  *  * user-name  /path/to/above/script.bash
share|improve this answer

If you must use dash, this will work:

mkfifo file1
mkfifo file2
xzcat file1.xz >file1&
xzcat file2.xz >file2&
diff file1 file2
rm -f file1 file2 #remove the FIFOs
share|improve this answer
That's a can of worm though as you have to make sure only one instance is run at a time and that the fifos are not readable by anybody, and that they are properly created and destroyed... – Stéphane Chazelas Oct 2 '13 at 15:28
@StephaneChazelas Agreed. Thanks for pointing this out. – Joseph R. Oct 2 '13 at 15:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.