script-functions: Set filetype to "sh" with vim

This helps with detecting the file type, since the heuristics fail.
check4progs: Change testing from ‘which’ to iterating over $PATH [Closes: issue1284]

This removes the availability of ‘which’ and improves performance when
‘which’ is an external program.

This patch also silently adds options to make the function more quiet
than its default behaviour.