G
gbostock
I'm trying to write a script that will do (UNIX) diffs on a set of
files. I also want to pipe the results to grep -v to eliminate the
trivial differences. The command gets quite long because of that and
also because I use the full path name for the files. So the command
looks like this:
`diff /dir/dir1/dir2/dir3/file1 /dir/dir1/dir2/dir3/file2 | grep -v
somestring | grep -v someotherstring ... >
/dir/dir1/dir2/dir4/file.diff`
Somehow that string is wrapped so that the UNIX command processor sees:
diff /dir/dir1/dir2/dir3/file1
/dir/dir1/dir2/dir3/file2
| grep -v somestring | grep -v someotherstring ...
so I get a message about the usage of diff, then it tries to execute
file2 as if it were a shell script, then it complains about an
unexpected | at the beginning of a command.
I do not put any \n's or anything like that in the string. If I build
that string with scalars into another scalar and I x that scalar in the
perl debugger, it shows that string as 3 lines, broken up exactly in
the way that causes the unix command processor to complain (as shown
above). I looked for a system variable that might control that
behavior, but couldn't find one.
I get the same results if I use backticks or the system function call.
Help?
Gerald
files. I also want to pipe the results to grep -v to eliminate the
trivial differences. The command gets quite long because of that and
also because I use the full path name for the files. So the command
looks like this:
`diff /dir/dir1/dir2/dir3/file1 /dir/dir1/dir2/dir3/file2 | grep -v
somestring | grep -v someotherstring ... >
/dir/dir1/dir2/dir4/file.diff`
Somehow that string is wrapped so that the UNIX command processor sees:
diff /dir/dir1/dir2/dir3/file1
/dir/dir1/dir2/dir3/file2
| grep -v somestring | grep -v someotherstring ...
so I get a message about the usage of diff, then it tries to execute
file2 as if it were a shell script, then it complains about an
unexpected | at the beginning of a command.
I do not put any \n's or anything like that in the string. If I build
that string with scalars into another scalar and I x that scalar in the
perl debugger, it shows that string as 3 lines, broken up exactly in
the way that causes the unix command processor to complain (as shown
above). I looked for a system variable that might control that
behavior, but couldn't find one.
I get the same results if I use backticks or the system function call.
Help?
Gerald