You need to check on the command line

  • 2
    I wonder why this could be needed. If the PATH folder is empty, this does not mean that some decisions need to be made on it, since deletion may lead to the impossibility of installing any packages. Yes, and delete the executable files just so it is impossible, they can be part of the executable. Yes, and write a chore. And imho is better not on the shell, but not on the pearl for example. - Mike
  • For example, in my gentoo directory, in all PATH directories there is a file called .keep , which is not executable. But its presence is necessary to emerge, the package installation manager, so that he knows that such a directory can never be deleted - Mike

1 answer 1

How to check whether all directories are registered in the PATH, there are executable files?

for example:

 $ for d in $(echo $PATH | sed 's/:/ /g'); do \ r=$(find $d -type f -executable | wc -l); [ $r -eq 0 ] && \ { echo "не во всех. например, тут нет: $d"; break; }; done 

example output:

 не во всех. например, тут нет: /opt/bin 

And how to remove non-executable?

Non-executable files can be deleted, like any other files, for example, with the rm program:

 $ rm /путь/к/удаляемому/файлу