dotfiles/terminal/.config/vifm/scripts/vifmdiff

32 lines
562 B
Text
Raw Permalink Normal View History

#!/bin/bash
if [ $# != 2 ] ; then
echo 'Expected exactly two arguments'
exit 1
fi
if [ -f "$1" ] && [ -f "$2" ]; then
args=
elif [ -d "$1" ] && [ -d "$2" ]; then
args='-r'
else
if [ -f "$1" ]; then
type_of_1='file'
else
type_of_1='directory'
fi
if [ -f "$2" ]; then
type_of_2='file'
else
type_of_2='directory'
fi
echo "Arguments are of different type ($type_of_1/$type_of_2)"
exit 1
fi
if diff $args "$1" "$2" > /dev/null 2>&1; then
echo 'Equal'
else
echo 'Not equal'
fi