Okay, first off I'm no hotshot programmer (and actually lack much familiarity with shell scripting) so apologies in advance if this problem is so trivial as to be irritating.
What I'm trying to do is drop the following command from either a shell script or a perl program. However, while it executes fine and does what it's supposed to when entered from the command line, I can't get it to work as a system call.
Here's the line:
Code:
/usr/bin/comm -23 <(/bin/sort /home/me/backup/latest.tmp | /usr/bin/uniq ) <( sort /home/me/tb/backup/yesterday.tmp | /usr/bin/uniq ) > /home/me/tb/backup/new
When I drop it from a shell script like this:
Code:
#!/bin/sh
/usr/bin/comm -23 <(/bin/sort /home/me/backup/latest.tmp | /usr/bin/uniq ) <( sort /home/me/tb/backup/yesterday.tmp | /usr/bin/uniq ) > /home/me/tb/backup/new
I get the following:
Code:
./script.sh: line 2: syntax error near unexpected token `('
./script.sh: line 2: `/usr/bin/comm -23 <(/bin/sort /home/me/backup/latest.tmp | /usr/bin/uniq ) <( sort /home/me/tb/backup/yesterday.tmp | /usr/bin/uniq ) > /home/me/tb/backup/new'
If I try escaping the ()s with \ or ', I get this:
Code:
./script.sh: line 2: (/bin/sort: No such file or directory
./script.sh: line 2: (: No such file or directory
/usr/bin/uniq: ): No such file or directory
I've tried a bunch of other stuff to get it working (deleting the ()s, spacing them differently, etc) and looked around online for a solution, but I can't find anything that works.
I tried a shell script directly only after anything I tried to drop it from perl with `` or system() failed with the same errors.
Not to be a rude dick, but I'd appreciate it if anyone who wants to suggest a solution test it first, as I don't know how much more failure I can handle.
Distro info (if it matters)
Code:
Linux version 2.6.18-164.el5PAE (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Sep 3 04:10:44 EDT 2009