http://qs1969.pair.com?node_id=11123995


in reply to file test results not as expected

You need to use the full path to the file for the file test. Change:
if (-f -x $file) {
to:
if (-f -x "$path/$file") {

This is how I do it: Finding commands in Unix PATH:

findcmd is a script which searches through the directories in the Unix PATH variable for executable files