Python Forum

Full Version: iatoc a script to list executable files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am thinking of coding a script to take command line arguments as command names and find all matches in the list of directories in the PATH environment variable and list them. if the directory has a symlink. list both the symlink and the referenced file. this would be for platforms that use the PATH variable. is there a more portable way to do this?
grep? (for contents)
file? (for filenames)
or glob from within script.
it's like the shell "which" command but it lists matches in all the directories so you know what can still run even if the file is removed. and for each, instead of just sowing the path, it runs "ls" to show more detail. you can see how big it is or if it's a symlink.