diff
In the simplest case, diff compares the contents of the two files from-file and to-file. A file name of - stands for text read from the standard input. As a special case, diff - - compares a copy of standard input to itself.[1]
If from-file is a directory and to-file is not, diff compares the file in from-file whose file name is that of to-file, and vice versa. The non-directory file must not be -.[1]
If both from-file and to-file are directories, diff compares corresponding files in both directories, in alphabetical order; this comparison is not recursive unless the -r or --recursive option is given. diff never compares the actual contents of a directory as if it were a file. The file that is fully specified may not be standard input, because standard input is nameless and the notion of file with the same name does not apply.[1]
Documentation
- man 1 'diff' [EN]
Syntax
diff [PARAMETER ...] FILE1 FILE2
Parameter
- -i, --ignore-case
- Ignore changes in case; consider upper- and lower-case letters equivalent.
- -t, --expand-tabs
- Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
- -w, --ignore-all-space
- Ignore white space when comparing lines.
Examples
diff 'myscript.ori.sh' 'myscript.sh' >'myscript.patch'
patch 'myscript.ori.sh' --input='myscript.patch' --output='myscript.new.sh'