23 lines
322 B
Bash
23 lines
322 B
Bash
#!bin/bash
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Please provide 2 files as arguments"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$1" ] || [ ! -f "$2" ]; then
|
|
echo "Both arguments must be files"
|
|
exit 1
|
|
fi
|
|
|
|
print() {
|
|
file="$1"
|
|
echo "$file"
|
|
head -n 2 "$file"
|
|
}
|
|
|
|
print "$1"
|
|
print "$2"
|
|
|
|
echo "Total number of characters is: $(cat "$1" "$2" | wc -c)"
|