This happens because your script can't find the date command. This gives you two options.
Option 1: Locate the date binary and give the full path
Run "whereis date" in your command prompt and it should output something liket his
date: /bin/date /usr/share/man/man1/date.1.gz
You can then either change
$(date +%Y-%m-%d)
to
$(/bin/date +%Y-%m-%d)
Option 2: Export a path where the binary should be looked for
The reason date can't be found is because it's not in the script's PATH variable. You can either just add /bin/ to PATH or have the same as you have in your shell. Run
echo $PATH
in your shell and it should output something liket his
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
What you then can do then is to set the scripts PATH variable to the same thing so it would look like this:
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
while read line
do
if [ ‘$($line | cut -c 1-10)’ == ‘$(date +%Y-%m-%d)’ ]
then
name=$($linea | cut -c 12-100)
fi
echo $name
done < archivos.txt