You can use a `while` loop, where the condition is based on the ability to read from standard input:
$ cat input.txt
Mar 16
Mar 12
Mar 13
Mar 19
Mar 14
Mar 17
$ cat ex.sh
#!/bin/bash
datediff() {
local d1="$(date -d "$1" +%s)"
local d2="$(date -d "$2" +%s)"
echo "$(( (d1 - d2) / 86400 )) days"
}
while read line; do
datediff 'now' "${line}"
done < "${1}"
$ ./ex.sh input.txt
111 days
115 days
114 days
108 days
113 days
110 days
The script here takes a single argument: the input file. While it can read a line from the file, it calls your `datediff` function passing `now` and the content of the `line` that it read from the file.