Running it gives this result:
[...]
65: /tmp/t.sh: line 11: 17838 Terminated tail -f /etc/hosts > /dev/null
66: /tmp/t.sh: line 11: 17840 Terminated tail -f /etc/hosts > /dev/null
67: /tmp/t.sh: line 11: 17842 Terminated tail -f /etc/hosts > /dev/null
68: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17844 Terminated tail -f /etc/hosts > /dev/null
69: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17847 Terminated tail -f /etc/hosts > /dev/null
70: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17850 Terminated tail -f /etc/hosts > /dev/null
71: tail: inotify cannot be used, reverting to polling: Too many open files
^C
#!/bin/bash
i=0
while [ $i -lt 1000 ];do
i=$((i+1))
echo -n "$i: "
tail -f /etc/hosts >/dev/null &
pid=$!
sleep 1
kill $pid
done
Running it gives this result:
[...]
65: /tmp/t.sh: line 11: 17838 Terminated tail -f /etc/hosts > /dev/null
66: /tmp/t.sh: line 11: 17840 Terminated tail -f /etc/hosts > /dev/null
67: /tmp/t.sh: line 11: 17842 Terminated tail -f /etc/hosts > /dev/null
68: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17844 Terminated tail -f /etc/hosts > /dev/null
69: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17847 Terminated tail -f /etc/hosts > /dev/null
70: tail: inotify cannot be used, reverting to polling: Too many open files
/tmp/t.sh: line 11: 17850 Terminated tail -f /etc/hosts > /dev/null
71: tail: inotify cannot be used, reverting to polling: Too many open files
^C