Starting with a command line comparison

I have Beyond Compare 3 installed to;

"C:\Program Files\Beyond Compare 3\BCompare.exe"

      

and Cygwin;

"C:\Cygwin\bin\bash.exe"

      

I would like to use a command like:

diff <file1> <file2>

      

to the Cygwin shell and have a fork shell - a process that opens two files outside of the comparison.

I looked at the Beyond Compare Support Page , but I'm afraid it was too short for me. I tried to copy the text verbatim (apart from the path to the executable) to no avail;

Instead of using a batch file, create a file named "bc.sh" with the following line:
"$(cygpath 'C:\Progra~1\Beyond~1\bcomp.exe')" `cygpath -w "$6"` `cygpath -w "$7"` /title1="$3" /title2="$5" /readonly 

      

Was I supposed to replace cygpath? I am getting "Command not found" error when I enter the command line name of the script.

gavina@whwgavina1 /cygdrive
$ "C:\Documents and Settings\gavina\Desktop\bc.sh"
bash: C:\Documents and Settings\gavina\Desktop\bc.sh: command not found

      

Does anyone have Beyond Compare as I described? Is this possible on Windows?

Thanks in advance!

+2


a source to share


3 answers


Inside Cygwin, the filesystem is more like unix. The cygpath component exists because the root of the drive appears elsewhere in the path. "C: \" means nothing to Cygwin, it assumes that "/" is the root and your drives must start from there, hence the cygpath extension. Also try using Form 8.3 like on the reference page:



"$ (cygpath 'C: \ Progra ~ 1 \ Beyond ~ 1 \ bcomp.exe')"

0


a source


@Romain Hippeau Thanks, I was a bit of an asshole.

To run a shell script in Cygwin, you must make it executable.

chmod 755 bc.sh 

      



Then use; to run your script;

./bc.sh

      

Where the script is located in the current directory.

0


a source


Add this function to your ~/.bashrc

file.

bc() {
  "/cygdrive/c/Program Files/Beyond Compare 3/BCompare.exe" $1 $2 -fv "Text Compare"
}

      

Then you can just write bc file1.txt file2.txt

on the command line and get a nice textual comparison using Beyond Compare.

0


a source







All Articles